This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 180791
Collapse All | Expand All

(-)a/.hgignore (+1 lines)
Lines 20-25 Link Here
20
^\.externalToolBuilders/.*$
20
^\.externalToolBuilders/.*$
21
^hs_err_pid[0-9]*\.log
21
^hs_err_pid[0-9]*\.log
22
^[^/]+/external/[^/]+\.(zip|jar|gz|bz2|gem|dll|xpi)$
22
^[^/]+/external/[^/]+\.(zip|jar|gz|bz2|gem|dll|xpi)$
23
^apisupport.equinoxdemo/equinoxdemo/netbinox/.*$
23
^o.apache.tools.ant.module/external/lib$
24
^o.apache.tools.ant.module/external/lib$
24
^classfile/\.nbintdb$
25
^classfile/\.nbintdb$
25
^classfile/classfile\.jar$
26
^classfile/classfile\.jar$
(-)e2a3e210c3db (+59 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
6
7
8
The contents of this file are subject to the terms of either the GNU
9
General Public License Version 2 only ("GPL") or the Common
10
Development and Distribution License("CDDL") (collectively, the
11
"License"). You may not use this file except in compliance with the
12
License. You can obtain a copy of the License at
13
http://www.netbeans.org/cddl-gplv2.html
14
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
specific language governing permissions and limitations under the
16
License.  When distributing the software, include this License Header
17
Notice in each file and include the License file at
18
nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
19
particular file as subject to the "Classpath" exception as provided
20
by Sun in the GPL Version 2 section of the License file that
21
accompanied this code. If applicable, add the following below the
22
License Header, with the fields enclosed by brackets [] replaced by
23
your own identifying information:
24
"Portions Copyrighted [year] [name of copyright owner]"
25
26
Contributor(s):
27
28
The Original Software is NetBeans. The Initial Developer of the Original
29
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30
Microsystems, Inc. All Rights Reserved.
31
32
If you wish your version of this file to be governed by only the CDDL
33
or only the GPL Version 2, indicate your decision by adding
34
"[Contributor] elects to include this software in this distribution
35
under the [CDDL or GPL Version 2] license." If you do not indicate a
36
single choice of license, a recipient has the option to distribute
37
your version of this file under either the CDDL, the GPL Version 2 or
38
to extend the choice of license to its licensees as provided above.
39
However, if you add GPL Version 2 code and therefore, elected the GPL
40
Version 2 license, then the option applies only if the new code is
41
made subject to such option by the copyright holder.
42
-->
43
<project basedir="." default="netbeans" name="apisupport.equinoxdemo">
44
    <import file="../nbbuild/templates/projectized.xml"/>
45
46
    <target name="jar" depends="zip-project,projectized-common.jar"/>
47
48
    <target name="zip-project" depends="init">
49
        <property name="examples" location="${build.classes.dir}/org/netbeans/modules/apisupport/equinoxdemo/"/>
50
        <mkdir dir="${examples}"/>
51
        <zip basedir="equinoxdemo" destfile="${examples}/EquinoxDemo.zip">
52
            <exclude name="netbinox/**"/>
53
            <exclude name="**/build/"/>
54
            <exclude name="**/dist/"/>
55
            <exclude name="**/nbproject/private/"/>
56
        </zip>
57
    </target>
58
59
</project>
(-)e2a3e210c3db (+2 lines)
Added Link Here
1
currentVersion=Equinox Sample {0}
2
LBL_splash_window_title=Starting Equinox Sample
(-)e2a3e210c3db (+2 lines)
Added Link Here
1
CTL_MainWindow_Title=Equinox Sample {0}
2
CTL_MainWindow_Title_No_Project=Equinox Sample {0}
(-)e2a3e210c3db (+15 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
3
<!-- for some information on what you could do (e.g. targets to override). -->
4
<!-- If you delete this file and reopen the project it will be recreated. -->
5
<project name="equinox-suite" basedir=".">
6
    <description>Builds the module suite equinox-suite.</description>
7
    <import file="nbproject/build-impl.xml"/>
8
9
    <property name="netbinox.updatecenter.url" value="http://hudson.apidesign.org/hudson/job/netbinox/lastStableBuild/artifact/build/updates/updates.xml"/>
10
    <target name="-init" depends="suite.-init">
11
        <autoupdate todir="netbinox" updatecenter="${netbinox.updatecenter.url}">
12
            <modules includes=".*" clusters="netbinox[0-9]*"/>
13
        </autoupdate>
14
    </target>
15
</project>
(-)e2a3e210c3db (+49 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
*** GENERATED FROM project.xml - DO NOT EDIT  ***
4
***         EDIT ../build.xml INSTEAD         ***
5
-->
6
<project name="equinox-suite-impl" basedir=".." xmlns:sproject="http://www.netbeans.org/ns/nb-module-suite-project/1">
7
    <fail message="Please build using Ant 1.7.1 or higher.">
8
        <condition>
9
            <not>
10
                <antversion atleast="1.7.1"/>
11
            </not>
12
        </condition>
13
    </fail>
14
    <property file="nbproject/private/platform-private.properties"/>
15
    <property file="nbproject/platform.properties"/>
16
    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
17
        <attribute name="name"/>
18
        <attribute name="value"/>
19
        <sequential>
20
            <property name="@{name}" value="${@{value}}"/>
21
        </sequential>
22
    </macrodef>
23
    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
24
        <attribute name="property"/>
25
        <attribute name="value"/>
26
        <sequential>
27
            <property name="@{property}" value="@{value}"/>
28
        </sequential>
29
    </macrodef>
30
    <property file="${user.properties.file}"/>
31
    <sproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
32
    <sproject:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
33
    <sproject:evalprops property="cluster.path.evaluated" value="${cluster.path}"/>
34
    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
35
        <condition>
36
            <not>
37
                <contains string="${cluster.path.evaluated}" substring="platform"/>
38
            </not>
39
        </condition>
40
    </fail>
41
    <fail message="Cannot find NetBeans build harness. ${line.separator}Check that nbplatform.${nbplatform.active}.netbeans.dest.dir and nbplatform.${nbplatform.active}.harness.dir are defined. ${line.separator}On a developer machine these are normally defined in ${user.properties.file}=${netbeans.user}/build.properties ${line.separator}but for automated builds you should pass these properties to Ant explicitly.">
42
        <condition>
43
            <not>
44
                <available type="dir" file="${harness.dir}"/>
45
            </not>
46
        </condition>
47
    </fail>
48
    <import file="${harness.dir}/suite.xml"/>
49
</project>
(-)e2a3e210c3db (+8 lines)
Added Link Here
1
build.xml.data.CRC32=4e759413
2
build.xml.script.CRC32=b432f9be
3
build.xml.stylesheet.CRC32=531c622b@1.36
4
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6
nbproject/build-impl.xml.data.CRC32=4e759413
7
nbproject/build-impl.xml.script.CRC32=1e22e482
8
nbproject/build-impl.xml.stylesheet.CRC32=56de960a@1.37
(-)e2a3e210c3db (+27 lines)
Added Link Here
1
cluster.path=\
2
    ${nbplatform.active.dir}/harness:\
3
    ${nbplatform.active.dir}/platform:\
4
    netbinox
5
disabled.modules=\
6
    org.jdesktop.layout,\
7
    org.netbeans.api.visual,\
8
    org.netbeans.core.execution,\
9
    org.netbeans.core.multiview,\
10
    org.netbeans.insane,\
11
    org.netbeans.libs.felix,\
12
    org.netbeans.libs.jsr223,\
13
    org.netbeans.modules.apisupport.harness,\
14
    org.netbeans.modules.apisupport.tc.cobertura,\
15
    org.netbeans.modules.autoupdate.services,\
16
    org.netbeans.modules.autoupdate.ui,\
17
    org.netbeans.modules.core.kit,\
18
    org.netbeans.modules.favorites,\
19
    org.netbeans.modules.jellytools.platform,\
20
    org.netbeans.modules.jemmy,\
21
    org.openide.compat,\
22
    org.openide.execution,\
23
    org.openide.options,\
24
    org.openide.util.enumerations
25
extcluster.netbinox.javadoc=
26
extcluster.netbinox.sources=
27
nbplatform.active=default
(-)e2a3e210c3db (+8 lines)
Added Link Here
1
app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif
2
project.license=gpl20
3
app.name=equinoxsample
4
app.title=Equinox Sample
5
branding.token=${app.name}
6
modules=\
7
    ${project.org.apidesign.netbinox.showbundles}
8
project.org.apidesign.netbinox.showbundles=showbundles
(-)e2a3e210c3db (+9 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project.suite</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-suite-project/1">
6
            <name>equinox-suite</name>
7
        </data>
8
    </configuration>
9
</project>
(-)e2a3e210c3db (+8 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
3
<!-- for some information on what you could do (e.g. targets to override). -->
4
<!-- If you delete this file and reopen the project it will be recreated. -->
5
<project name="org.apidesign.netbinox.showbundles" default="netbeans" basedir=".">
6
    <description>Builds, tests, and runs the project org.apidesign.netbinox.showbundles.</description>
7
    <import file="nbproject/build-impl.xml"/>
8
</project>
(-)e2a3e210c3db (+9 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-Activator: org.apidesign.netbinox.showbundles.Installer
3
Bundle-Localization: org/apidesign/netbinox/showbundles/Bundle
4
Bundle-Name: %OpenIDE-Module-Name
5
Bundle-SymbolicName: org.apidesign.netbinox.showbundles
6
Bundle-Version: 1.0
7
Import-Package: org.osgi.framework
8
OpenIDE-Module-Layer: org/apidesign/netbinox/showbundles/layer.xml
9
(-)e2a3e210c3db (+45 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
*** GENERATED FROM project.xml - DO NOT EDIT  ***
4
***         EDIT ../build.xml INSTEAD         ***
5
-->
6
<project name="org.apidesign.netbinox.showbundles-impl" basedir="..">
7
    <fail message="Please build using Ant 1.7.1 or higher.">
8
        <condition>
9
            <not>
10
                <antversion atleast="1.7.1"/>
11
            </not>
12
        </condition>
13
    </fail>
14
    <property file="nbproject/private/suite-private.properties"/>
15
    <property file="nbproject/suite.properties"/>
16
    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
17
    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
18
    <property file="${suite.dir}/nbproject/platform.properties"/>
19
    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
20
        <attribute name="name"/>
21
        <attribute name="value"/>
22
        <sequential>
23
            <property name="@{name}" value="${@{value}}"/>
24
        </sequential>
25
    </macrodef>
26
    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
27
        <attribute name="property"/>
28
        <attribute name="value"/>
29
        <sequential>
30
            <property name="@{property}" value="@{value}"/>
31
        </sequential>
32
    </macrodef>
33
    <property file="${user.properties.file}"/>
34
    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
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"/>
36
    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
37
    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
38
        <condition>
39
            <not>
40
                <contains string="${cluster.path.evaluated}" substring="platform"/>
41
            </not>
42
        </condition>
43
    </fail>
44
    <import file="${harness.dir}/build.xml"/>
45
</project>
(-)e2a3e210c3db (+8 lines)
Added Link Here
1
build.xml.data.CRC32=3a4a90c7
2
build.xml.script.CRC32=fe55fcc8
3
build.xml.stylesheet.CRC32=79c3b980@1.37
4
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6
nbproject/build-impl.xml.data.CRC32=3a4a90c7
7
nbproject/build-impl.xml.script.CRC32=0acebef1
8
nbproject/build-impl.xml.stylesheet.CRC32=261c4bef@1.37
(-)e2a3e210c3db (+2 lines)
Added Link Here
1
javac.source=1.6
2
javac.compilerargs=-Xlint -Xlint:-serial
(-)e2a3e210c3db (+92 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6
            <code-name-base>org.apidesign.netbinox.showbundles</code-name-base>
7
            <suite-component/>
8
            <module-dependencies>
9
                <dependency>
10
                    <code-name-base>org.netbeans.libs.osgi</code-name-base>
11
                    <build-prerequisite/>
12
                    <compile-dependency/>
13
                    <run-dependency>
14
                        <specification-version>1.0</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
18
                    <code-name-base>org.netbeans.modules.settings</code-name-base>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
21
                    <run-dependency>
22
                        <release-version>1</release-version>
23
                        <specification-version>1.25</specification-version>
24
                    </run-dependency>
25
                </dependency>
26
                <dependency>
27
                    <code-name-base>org.openide.awt</code-name-base>
28
                    <build-prerequisite/>
29
                    <compile-dependency/>
30
                    <run-dependency>
31
                        <specification-version>7.21</specification-version>
32
                    </run-dependency>
33
                </dependency>
34
                <dependency>
35
                    <code-name-base>org.openide.explorer</code-name-base>
36
                    <build-prerequisite/>
37
                    <compile-dependency/>
38
                    <run-dependency>
39
                        <specification-version>6.26</specification-version>
40
                    </run-dependency>
41
                </dependency>
42
                <dependency>
43
                    <code-name-base>org.openide.nodes</code-name-base>
44
                    <build-prerequisite/>
45
                    <compile-dependency/>
46
                    <run-dependency>
47
                        <specification-version>7.14</specification-version>
48
                    </run-dependency>
49
                </dependency>
50
                <dependency>
51
                    <code-name-base>org.openide.util</code-name-base>
52
                    <build-prerequisite/>
53
                    <compile-dependency/>
54
                    <run-dependency>
55
                        <specification-version>8.1</specification-version>
56
                    </run-dependency>
57
                </dependency>
58
                <dependency>
59
                    <code-name-base>org.openide.util.lookup</code-name-base>
60
                    <build-prerequisite/>
61
                    <compile-dependency/>
62
                    <run-dependency>
63
                        <specification-version>8.1</specification-version>
64
                    </run-dependency>
65
                </dependency>
66
                <dependency>
67
                    <code-name-base>org.openide.windows</code-name-base>
68
                    <build-prerequisite/>
69
                    <compile-dependency/>
70
                    <run-dependency>
71
                        <specification-version>6.32</specification-version>
72
                    </run-dependency>
73
                </dependency>
74
            </module-dependencies>
75
            <test-dependencies>
76
                <test-type>
77
                    <name>unit</name>
78
                    <test-dependency>
79
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
80
                        <compile-dependency/>
81
                    </test-dependency>
82
                    <test-dependency>
83
                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
84
                        <recursive/>
85
                        <compile-dependency/>
86
                    </test-dependency>
87
                </test-type>
88
            </test-dependencies>
89
            <public-packages/>
90
        </data>
91
    </configuration>
92
</project>
(-)e2a3e210c3db (+1 lines)
Added Link Here
1
suite.dir=${basedir}/..
(-)e2a3e210c3db (+6 lines)
Added Link Here
1
CTL_ShowBundlesAction=ShowBundles
2
CTL_ShowBundlesTopComponent=ShowBundles Window
3
HINT_ShowBundlesTopComponent=This is a ShowBundles window
4
OpenIDE-Module-Name=Show OSGi Bundle List
5
6
LAB_AllBundles=All Bundles
(-)e2a3e210c3db (+97 lines)
Added Link Here
1
/*
2
 *  Copyright (C) 2010 Jaroslav Tulach
3
 * 
4
 *  This program is free software; you can redistribute it and/or
5
 *  modify it under the terms of the GNU General Public License
6
 *  as published by the Free Software Foundation; either version 2
7
 *  of the License, or (at your option) any later version.
8
 * 
9
 *  This program is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *  GNU General Public License for more details.
13
 * 
14
 *  You should have received a copy of the GNU General Public License
15
 *  along with this program; if not, write to the Free Software
16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 */
18
package org.apidesign.netbinox.showbundles;
19
20
import java.awt.Image;
21
import org.openide.nodes.BeanNode;
22
import org.openide.nodes.Children;
23
import org.openide.nodes.Node;
24
import org.openide.util.Exceptions;
25
import org.openide.util.ImageUtilities;
26
import org.osgi.framework.Bundle;
27
import org.osgi.framework.BundleActivator;
28
import org.osgi.framework.BundleContext;
29
import org.osgi.framework.BundleEvent;
30
import org.osgi.framework.BundleListener;
31
32
/**
33
 * Remembers connection to BundleContext.
34
 */
35
public class Installer implements BundleActivator {
36
    private static BundleContext context;
37
38
    @Override
39
    public void start(BundleContext c) throws Exception {
40
        context = c;
41
    }
42
43
    @Override
44
    public void stop(BundleContext c) throws Exception {
45
        context = null;
46
    }
47
48
    public static Children createBundleChildren() {
49
        assert context != null;
50
        return new BundleChildren();
51
    }
52
53
    private static final class BundleChildren extends Children.Keys<Bundle>
54
    implements BundleListener {
55
        @Override
56
        protected void addNotify() {
57
            context.addBundleListener(this);
58
            bundleChanged(null);
59
        }
60
61
        @Override
62
        protected void removeNotify() {
63
            context.removeBundleListener(this);
64
        }
65
66
        @Override
67
        protected Node[] createNodes(Bundle t) {
68
            try {
69
                Node bn = new BeanNode<Bundle>(t) {
70
                    @Override
71
                    public Image getIcon(int type) {
72
                        if (getBean().getLocation().startsWith("netigso:/")) { // NOI18N
73
                            return ImageUtilities.loadImage("org/apidesign/netbinox/showbundles/module.png");
74
                        } else {
75
                            return ImageUtilities.loadImage("org/apidesign/netbinox/showbundles/bundle.png");
76
                        }
77
                    }
78
79
                    @Override
80
                    public Image getOpenedIcon(int type) {
81
                        return getIcon(type);
82
                    }
83
                };
84
                bn.setName(t.getSymbolicName());
85
                return new Node[]{bn};
86
            } catch (Exception ex) {
87
                Exceptions.printStackTrace(ex);
88
                return null;
89
            }
90
        }
91
92
        @Override
93
        public void bundleChanged(BundleEvent be) {
94
            setKeys(context.getBundles());
95
        }
96
    }
97
}
(-)e2a3e210c3db (+58 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Component id="split" pref="1168" max="32767" attributes="0"/>
22
              <EmptySpace max="-2" attributes="0"/>
23
          </Group>
24
      </Group>
25
    </DimensionLayout>
26
    <DimensionLayout dim="1">
27
      <Group type="103" groupAlignment="0" attributes="0">
28
          <Group type="102" alignment="0" attributes="0">
29
              <EmptySpace min="-2" max="-2" attributes="0"/>
30
              <Component id="split" pref="486" max="32767" attributes="0"/>
31
              <EmptySpace min="-2" max="-2" attributes="0"/>
32
          </Group>
33
      </Group>
34
    </DimensionLayout>
35
  </Layout>
36
  <SubComponents>
37
    <Container class="javax.swing.JSplitPane" name="split">
38
39
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
40
      <SubComponents>
41
        <Component class="org.openide.explorer.view.BeanTreeView" name="tree">
42
          <Constraints>
43
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
44
              <JSplitPaneConstraints position="left"/>
45
            </Constraint>
46
          </Constraints>
47
        </Component>
48
        <Component class="org.openide.explorer.propertysheet.PropertySheetView" name="sheet">
49
          <Constraints>
50
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
51
              <JSplitPaneConstraints position="right"/>
52
            </Constraint>
53
          </Constraints>
54
        </Component>
55
      </SubComponents>
56
    </Container>
57
  </SubComponents>
58
</Form>
(-)e2a3e210c3db (+166 lines)
Added Link Here
1
/*
2
 *  Copyright (C) 2010 Jaroslav Tulach
3
 * 
4
 *  This program is free software; you can redistribute it and/or
5
 *  modify it under the terms of the GNU General Public License
6
 *  as published by the Free Software Foundation; either version 2
7
 *  of the License, or (at your option) any later version.
8
 * 
9
 *  This program is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *  GNU General Public License for more details.
13
 * 
14
 *  You should have received a copy of the GNU General Public License
15
 *  along with this program; if not, write to the Free Software
16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 */
18
package org.apidesign.netbinox.showbundles;
19
20
import java.util.logging.Logger;
21
import org.openide.util.NbBundle;
22
import org.openide.windows.TopComponent;
23
import org.openide.windows.WindowManager;
24
import org.netbeans.api.settings.ConvertAsProperties;
25
import org.openide.explorer.ExplorerManager;
26
import org.openide.nodes.AbstractNode;
27
import org.openide.util.ImageUtilities;
28
29
/**
30
 * Top component which displays list of bundles.
31
 */
32
@ConvertAsProperties(dtd = "-//org.apidesign.netbinox.showbundles//ShowBundles//EN",
33
autostore = false)
34
public final class ShowBundlesTopComponent extends TopComponent
35
implements ExplorerManager.Provider {
36
    private ExplorerManager em;
37
    private static ShowBundlesTopComponent instance;
38
    private static final String PREFERRED_ID = "ShowBundlesTopComponent";
39
40
    public ShowBundlesTopComponent() {
41
        setIcon(ImageUtilities.loadImage("org/apidesign/netbinox/showbundles/bundle.png")); // NOI18N
42
        AbstractNode root = new AbstractNode(Installer.createBundleChildren());
43
        root.setName("bundles"); // NOI18N
44
        root.setIconBaseWithExtension("org/apidesign/netbinox/showbundles/bundle.png"); // NOI18N
45
        root.setDisplayName(NbBundle.getMessage(ShowBundlesTopComponent.class, "LAB_AllBundles"));
46
        this.em = new ExplorerManager();
47
        em.setRootContext(root);
48
        initComponents();
49
        setName(NbBundle.getMessage(ShowBundlesTopComponent.class, "CTL_ShowBundlesTopComponent"));
50
        setToolTipText(NbBundle.getMessage(ShowBundlesTopComponent.class, "HINT_ShowBundlesTopComponent"));
51
    }
52
53
    /** This method is called from within the constructor to
54
     * initialize the form.
55
     * WARNING: Do NOT modify this code. The content of this method is
56
     * always regenerated by the Form Editor.
57
     */
58
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
59
    private void initComponents() {
60
61
        split = new javax.swing.JSplitPane();
62
        tree = new org.openide.explorer.view.BeanTreeView();
63
        sheet = new org.openide.explorer.propertysheet.PropertySheetView();
64
65
        split.setLeftComponent(tree);
66
        split.setRightComponent(sheet);
67
68
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
69
        this.setLayout(layout);
70
        layout.setHorizontalGroup(
71
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
72
            .addGroup(layout.createSequentialGroup()
73
                .addContainerGap()
74
                .addComponent(split, javax.swing.GroupLayout.DEFAULT_SIZE, 1168, Short.MAX_VALUE)
75
                .addContainerGap())
76
        );
77
        layout.setVerticalGroup(
78
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
79
            .addGroup(layout.createSequentialGroup()
80
                .addContainerGap()
81
                .addComponent(split, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
82
                .addContainerGap())
83
        );
84
    }// </editor-fold>//GEN-END:initComponents
85
86
    // Variables declaration - do not modify//GEN-BEGIN:variables
87
    private org.openide.explorer.propertysheet.PropertySheetView sheet;
88
    private javax.swing.JSplitPane split;
89
    private org.openide.explorer.view.BeanTreeView tree;
90
    // End of variables declaration//GEN-END:variables
91
    /**
92
     * Gets default instance. Do not use directly: reserved for *.settings files only,
93
     * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
94
     * To obtain the singleton instance, use {@link #findInstance}.
95
     */
96
    public static synchronized ShowBundlesTopComponent getDefault() {
97
        if (instance == null) {
98
            instance = new ShowBundlesTopComponent();
99
        }
100
        return instance;
101
    }
102
103
    /**
104
     * Obtain the ShowBundlesTopComponent instance. Never call {@link #getDefault} directly!
105
     */
106
    public static synchronized ShowBundlesTopComponent findInstance() {
107
        TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
108
        if (win == null) {
109
            Logger.getLogger(ShowBundlesTopComponent.class.getName()).warning(
110
                    "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
111
            return getDefault();
112
        }
113
        if (win instanceof ShowBundlesTopComponent) {
114
            return (ShowBundlesTopComponent) win;
115
        }
116
        Logger.getLogger(ShowBundlesTopComponent.class.getName()).warning(
117
                "There seem to be multiple components with the '" + PREFERRED_ID
118
                + "' ID. That is a potential source of errors and unexpected behavior.");
119
        return getDefault();
120
    }
121
122
    @Override
123
    public int getPersistenceType() {
124
        return TopComponent.PERSISTENCE_ALWAYS;
125
    }
126
127
    @Override
128
    public void componentOpened() {
129
        // TODO add custom code on component opening
130
    }
131
132
    @Override
133
    public void componentClosed() {
134
        // TODO add custom code on component closing
135
    }
136
137
    void writeProperties(java.util.Properties p) {
138
        // better to version settings since initial version as advocated at
139
        // http://wiki.apidesign.org/wiki/PropertyFiles
140
        p.setProperty("version", "1.0");
141
        // TODO store your settings
142
    }
143
144
    Object readProperties(java.util.Properties p) {
145
        if (instance == null) {
146
            instance = this;
147
        }
148
        instance.readPropertiesImpl(p);
149
        return instance;
150
    }
151
152
    private void readPropertiesImpl(java.util.Properties p) {
153
        String version = p.getProperty("version");
154
        // TODO read your settings according to their version
155
    }
156
157
    @Override
158
    protected String preferredID() {
159
        return PREFERRED_ID;
160
    }
161
162
    @Override
163
    public ExplorerManager getExplorerManager() {
164
        return em;
165
    }
166
}
(-)e2a3e210c3db (+12 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
To change this template, choose Tools | Templates
4
and open the template in the editor.
5
-->
6
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
7
<settings version="1.0">
8
    <module name="org.apidesign.netbinox.showbundles" spec="1.0"/>
9
    <instanceof class="org.openide.windows.TopComponent"/>
10
    <instanceof class="org.apidesign.netbinox.showbundles.ShowBundlesTopComponent"/>
11
    <instance class="org.apidesign.netbinox.showbundles.ShowBundlesTopComponent" method="getDefault"/>
12
</settings>
(-)e2a3e210c3db (+11 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
To change this template, choose Tools | Templates
4
and open the template in the editor.
5
-->
6
<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
7
<tc-ref version="2.0" >
8
    <module name="org.apidesign.netbinox.showbundles" spec="1.0"/>
9
    <tc-id id="ShowBundlesTopComponent"/>
10
    <state opened="true"/>
11
</tc-ref>
(-)e2a3e210c3db (+31 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
3
<filesystem>
4
    <folder name="Actions">
5
        <folder name="Window">
6
            <file name="org-apidesign-netbinox-showbundles-ShowBundlesAction.instance">
7
                <attr name="component" methodvalue="org.apidesign.netbinox.showbundles.ShowBundlesTopComponent.findInstance"/>
8
                <attr name="displayName" bundlevalue="org.apidesign.netbinox.showbundles.Bundle#CTL_ShowBundlesAction"/>
9
                <attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/>
10
                <attr name="iconBase" stringvalue="org/apidesign/netbinox/showbundles/bundle.png"/>
11
            </file>
12
        </folder>
13
    </folder>
14
    <folder name="Menu">
15
        <folder name="Window">
16
            <file name="ShowBundlesAction.shadow">
17
                <attr name="originalFile" stringvalue="Actions/Window/org-apidesign-netbinox-showbundles-ShowBundlesAction.instance"/>
18
            </file>
19
        </folder>
20
    </folder>
21
    <folder name="Windows2">
22
        <folder name="Components">
23
            <file name="ShowBundlesTopComponent.settings" url="ShowBundlesTopComponentSettings.xml"/>
24
        </folder>
25
        <folder name="Modes">
26
            <folder name="editor">
27
                <file name="ShowBundlesTopComponent.wstcref" url="ShowBundlesTopComponentWstcref.xml"/>
28
            </folder>
29
        </folder>
30
    </folder>
31
</filesystem>
(-)e2a3e210c3db (+56 lines)
Added Link Here
1
/*
2
 *  Copyright (C) 2010 Jaroslav Tulach
3
 * 
4
 *  This program is free software; you can redistribute it and/or
5
 *  modify it under the terms of the GNU General Public License
6
 *  as published by the Free Software Foundation; either version 2
7
 *  of the License, or (at your option) any later version.
8
 * 
9
 *  This program is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *  GNU General Public License for more details.
13
 * 
14
 *  You should have received a copy of the GNU General Public License
15
 *  along with this program; if not, write to the Free Software
16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 */
18
19
package org.apidesign.netbinox.showbundles;
20
21
import java.util.List;
22
import junit.framework.Test;
23
import org.netbeans.junit.NbModuleSuite;
24
import org.netbeans.junit.NbTestCase;
25
import org.openide.nodes.Children;
26
import org.openide.nodes.Node;
27
28
/** Integration test that launches the application and checks
29
 * the status of enabled bundles.
30
 */
31
public class InstallerTest extends NbTestCase {
32
    
33
    public InstallerTest(String testName) {
34
        super(testName);
35
    }
36
37
    public static Test suite() {
38
        return NbModuleSuite.create(
39
            NbModuleSuite.emptyConfiguration().addTest(InstallerTest.class).gui(false)
40
            .clusters(".*")
41
        );
42
    }
43
44
    public void testChildrenAndTheirNodes() throws Exception {
45
        Children ch = Installer.createBundleChildren();
46
        List<Node> arr = ch.snapshot();
47
48
        for (Node n : arr) {
49
            if (n.getName().contains("equinox")) {
50
                // OK
51
                return;
52
            }
53
        }
54
        fail("Equinox not found: " + arr);
55
    }
56
}
(-)e2a3e210c3db (+6 lines)
Added Link Here
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.apisupport.equinoxdemo
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.1
5
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/equinoxdemo/layer.xml
6
AutoUpdate-Show-In-Client: false
(-)e2a3e210c3db (+6 lines)
Added Link Here
1
javac.source=1.6
2
javac.compilerargs=-Xlint -Xlint:-serial
3
test-unit-sys-prop.test.nbroot=${nb_all}
4
test.unit.run.cp.extra=${tools.jar}
5
toplink-essentials.jar=${nb_all}/nbbuild/netbeans/${nb.cluster.java.dir}/modules/ext/toplink/toplink-essentials.jar
6
toplink-essentials-agent.jar=${nb_all}/nbbuild/netbeans/${nb.cluster.java.dir}/modules/ext/toplink/toplink-essentials-agent.jar
(-)e2a3e210c3db (+95 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6
            <code-name-base>org.netbeans.modules.apisupport.equinoxdemo</code-name-base>
7
            <module-dependencies>
8
                <dependency>
9
                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.29</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
18
                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
21
                    <run-dependency>
22
                        <release-version>1</release-version>
23
                        <specification-version>1.41</specification-version>
24
                    </run-dependency>
25
                </dependency>
26
                <dependency>
27
                    <code-name-base>org.openide.awt</code-name-base>
28
                    <build-prerequisite/>
29
                    <compile-dependency/>
30
                    <run-dependency>
31
                        <specification-version>7.20</specification-version>
32
                    </run-dependency>
33
                </dependency>
34
                <dependency>
35
                    <code-name-base>org.openide.dialogs</code-name-base>
36
                    <build-prerequisite/>
37
                    <compile-dependency/>
38
                    <run-dependency>
39
                        <specification-version>7.14</specification-version>
40
                    </run-dependency>
41
                </dependency>
42
                <dependency>
43
                    <code-name-base>org.openide.filesystems</code-name-base>
44
                    <build-prerequisite/>
45
                    <compile-dependency/>
46
                    <run-dependency>
47
                        <specification-version>7.33</specification-version>
48
                    </run-dependency>
49
                </dependency>
50
                <dependency>
51
                    <code-name-base>org.openide.util</code-name-base>
52
                    <build-prerequisite/>
53
                    <compile-dependency/>
54
                    <run-dependency>
55
                        <specification-version>8.0</specification-version>
56
                    </run-dependency>
57
                </dependency>
58
            </module-dependencies>
59
            <test-dependencies>
60
                <test-type>
61
                    <name>unit</name>
62
                    <test-dependency>
63
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
64
                        <compile-dependency/>
65
                    </test-dependency>
66
                    <test-dependency>
67
                        <code-name-base>org.netbeans.modules.apisupport.equinoxdemo</code-name-base>
68
                        <recursive/>
69
                        <compile-dependency/>
70
                    </test-dependency>
71
                    <test-dependency>
72
                        <code-name-base>org.netbeans.modules.apisupport.project</code-name-base>
73
                        <recursive/>
74
                        <compile-dependency/>
75
                        <test/>
76
                    </test-dependency>
77
                    <test-dependency>
78
                        <code-name-base>org.netbeans.modules.masterfs</code-name-base>
79
                        <recursive/>
80
                        <compile-dependency/>
81
                    </test-dependency>
82
                    <test-dependency>
83
                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
84
                        <recursive/>
85
                        <compile-dependency/>
86
                    </test-dependency>
87
                    <test-dependency>
88
                        <code-name-base>org.netbeans.modules.projectui</code-name-base>
89
                    </test-dependency>
90
                </test-type>
91
            </test-dependencies>
92
            <public-packages/>
93
        </data>
94
    </configuration>
95
</project>
(-)e2a3e210c3db (+42 lines)
Added Link Here
1
OpenIDE-Module-Name=Equinox Application Platform Sample
2
3
LBL_CreateProjectStep=Create a new Equinox Application project
4
LBL_DownloadStep=Download libraries
5
OpenIDE-Module-Display-Category=Developing NetBeans
6
OpenIDE-Module-Long-Description=\
7
    Sample application based on the NetBeans platform and Equinox.
8
OpenIDE-Module-Short-Description=Sample NetBeans platform application.
9
SampleAppFile=Equinox based Platform Application
10
11
# {0} - step #
12
# {1} - step count
13
SampleAppWizardIterator.name.format={0} of {1}
14
SampleAppPanelVisual.project_name=Project &Name:
15
SampleAppPanelVisual.default_prj_name=Equinox Application
16
SampleAppPanelVisual.folder_exists=Project Folder already exists and is not empty.
17
SampleAppPanelVisual.folder_creation_error=Project Folder cannot be created.
18
SampleAppPanelVisual.invalid_path=Project Folder is not a valid path.
19
SampleAppPanelVisual.invalid_folder_name=Project Name is not a valid folder name.
20
SampleAppPanelVisual.select_project_location=Select Project Location
21
SampleAppPanelVisual.project_folder=Project &Folder:
22
SampleAppPanelVisual.browse=Br&owse...
23
SampleAppPanelVisual.project_location=Project &Location:
24
SampleAppWarningVisual.readLicense.text=I agree with terms of GPL v2.0 license
25
MSG_WARNING=<html>\
26
 <p>This sample requires additional binaries \
27
 (provided by the <a href="http://wiki.apidesign.org/wiki/Netbinox">Netbinox</a> project)\
28
 distributed under GPL v2.0 license. Do you want to download them now? \
29
 </p>\
30
 <p>\
31
 In case some application is based on this sample it may become subject of \
32
 <a href="http://wiki.apidesign.org/wiki/Netbinox">Netbinox</a>'s GPL v2.0 license restrictions. \
33
 You may be required to redistribute sources of such application \
34
 under similar license. \
35
 <a href="http://wiki.apidesign.org/wiki/GPL">Read more</a> about the \
36
 viral nature of GPL and ways to avoid it. \
37
 </p>\
38
 <p>\
39
 Click <b>finish</b> to download and use the <a href="http://wiki.apidesign.org/wiki/GPL">Netbinox</a>
40
 <a href="http://wiki.apidesign.org/wiki/GPL">GPL</a> components of this sample. \
41
 </p>
42
SampleAppWarningVisual.info.contentType=text/html
(-)e2a3e210c3db (+54 lines)
Added Link Here
1
<!--
2
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
4
Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
5
6
7
The contents of this file are subject to the terms of either the GNU
8
General Public License Version 2 only ("GPL") or the Common
9
Development and Distribution License("CDDL") (collectively, the
10
"License"). You may not use this file except in compliance with the
11
License. You can obtain a copy of the License at
12
http://www.netbeans.org/cddl-gplv2.html
13
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14
specific language governing permissions and limitations under the
15
License.  When distributing the software, include this License Header
16
Notice in each file and include the License file at
17
nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
18
particular file as subject to the "Classpath" exception as provided
19
by Sun in the GPL Version 2 section of the License file that
20
accompanied this code. If applicable, add the following below the
21
License Header, with the fields enclosed by brackets [] replaced by
22
your own identifying information:
23
"Portions Copyrighted [year] [name of copyright owner]"
24
25
Contributor(s):
26
27
The Original Software is NetBeans. The Initial Developer of the Original
28
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
29
Microsystems, Inc. All Rights Reserved.
30
31
If you wish your version of this file to be governed by only the CDDL
32
or only the GPL Version 2, indicate your decision by adding
33
"[Contributor] elects to include this software in this distribution
34
under the [CDDL or GPL Version 2] license." If you do not indicate a
35
single choice of license, a recipient has the option to distribute
36
your version of this file under either the CDDL, the GPL Version 2 or
37
to extend the choice of license to its licensees as provided above.
38
However, if you add GPL Version 2 code and therefore, elected the GPL
39
Version 2 license, then the option applies only if the new code is
40
made subject to such option by the copyright holder.
41
-->
42
43
<html>
44
<head>
45
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
46
</head>
47
    <body>
48
        Illustrates how to use the NetBeans Platform and Equinox together.
49
        See
50
        <a href="http://wiki.apidesign.org/wiki/NetbinoxTutorial">tutorial</a>
51
        for more information.
52
    </body>
53
</html>
54
(-)e2a3e210c3db (+118 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
6
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
7
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
10
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
11
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
13
  </AuxValues>
14
15
  <Layout>
16
    <DimensionLayout dim="0">
17
      <Group type="103" groupAlignment="0" attributes="0">
18
          <Group type="102" attributes="0">
19
              <EmptySpace min="-2" max="-2" attributes="0"/>
20
              <Group type="103" groupAlignment="0" attributes="0">
21
                  <Component id="projectNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
22
                  <Component id="projectLocationLabel" alignment="0" min="-2" max="-2" attributes="0"/>
23
                  <Component id="createdFolderLabel" alignment="0" min="-2" max="-2" attributes="0"/>
24
              </Group>
25
              <EmptySpace min="-2" max="-2" attributes="0"/>
26
              <Group type="103" groupAlignment="0" attributes="0">
27
                  <Component id="projectNameTextField" alignment="1" pref="191" max="32767" attributes="0"/>
28
                  <Component id="projectLocationTextField" alignment="1" pref="191" max="32767" attributes="0"/>
29
                  <Component id="createdFolderTextField" alignment="1" pref="191" max="32767" attributes="0"/>
30
              </Group>
31
              <EmptySpace min="-2" max="-2" attributes="0"/>
32
              <Component id="browseButton" min="-2" max="-2" attributes="0"/>
33
              <EmptySpace min="-2" max="-2" attributes="0"/>
34
          </Group>
35
      </Group>
36
    </DimensionLayout>
37
    <DimensionLayout dim="1">
38
      <Group type="103" groupAlignment="0" attributes="0">
39
          <Group type="102" attributes="0">
40
              <EmptySpace max="-2" attributes="0"/>
41
              <Group type="103" groupAlignment="3" attributes="0">
42
                  <Component id="projectNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
43
                  <Component id="projectNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
44
              </Group>
45
              <EmptySpace max="-2" attributes="0"/>
46
              <Group type="103" groupAlignment="3" attributes="0">
47
                  <Component id="projectLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
48
                  <Component id="projectLocationTextField" alignment="3" min="-2" max="-2" attributes="0"/>
49
                  <Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
50
              </Group>
51
              <EmptySpace max="-2" attributes="0"/>
52
              <Group type="103" groupAlignment="3" attributes="0">
53
                  <Component id="createdFolderLabel" alignment="3" min="-2" max="-2" attributes="0"/>
54
                  <Component id="createdFolderTextField" alignment="3" min="-2" max="-2" attributes="0"/>
55
              </Group>
56
              <EmptySpace pref="213" max="32767" attributes="0"/>
57
          </Group>
58
      </Group>
59
    </DimensionLayout>
60
  </Layout>
61
  <SubComponents>
62
    <Component class="javax.swing.JLabel" name="projectNameLabel">
63
      <Properties>
64
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
65
          <ComponentRef name="projectNameTextField"/>
66
        </Property>
67
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
68
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="SampleAppPanelVisual.project_name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
69
        </Property>
70
      </Properties>
71
      <AuxValues>
72
        <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
73
      </AuxValues>
74
    </Component>
75
    <Component class="javax.swing.JTextField" name="projectNameTextField">
76
    </Component>
77
    <Component class="javax.swing.JLabel" name="projectLocationLabel">
78
      <Properties>
79
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
80
          <ComponentRef name="projectLocationTextField"/>
81
        </Property>
82
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
83
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="SampleAppPanelVisual.project_location" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
84
        </Property>
85
      </Properties>
86
      <AuxValues>
87
        <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
88
      </AuxValues>
89
    </Component>
90
    <Component class="javax.swing.JTextField" name="projectLocationTextField">
91
    </Component>
92
    <Component class="javax.swing.JButton" name="browseButton">
93
      <Properties>
94
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
95
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="SampleAppPanelVisual.browse" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
96
        </Property>
97
      </Properties>
98
      <Events>
99
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
100
      </Events>
101
    </Component>
102
    <Component class="javax.swing.JLabel" name="createdFolderLabel">
103
      <Properties>
104
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
105
          <ComponentRef name="createdFolderTextField"/>
106
        </Property>
107
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
108
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="SampleAppPanelVisual.project_folder" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
109
        </Property>
110
      </Properties>
111
    </Component>
112
    <Component class="javax.swing.JTextField" name="createdFolderTextField">
113
      <Properties>
114
        <Property name="editable" type="boolean" value="false"/>
115
      </Properties>
116
    </Component>
117
  </SubComponents>
118
</Form>
(-)e2a3e210c3db (+300 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.modules.apisupport.equinoxdemo;
42
43
import java.io.File;
44
import javax.swing.JFileChooser;
45
import javax.swing.JPanel;
46
import javax.swing.event.DocumentEvent;
47
import javax.swing.event.DocumentListener;
48
import javax.swing.text.Document;
49
import org.netbeans.spi.project.ui.support.ProjectChooser;
50
import org.openide.WizardDescriptor;
51
import org.openide.WizardValidationException;
52
import org.openide.filesystems.FileUtil;
53
54
public class SampleAppPanelVisual extends JPanel implements DocumentListener {
55
    
56
    private static final String WIZARD_PANEL_ERROR_MESSAGE = WizardDescriptor.PROP_ERROR_MESSAGE; // NOI18N
57
58
    public static final String PROP_PROJECT_NAME = "projectName"; // NOI18N
59
    
60
    private SampleAppWizardPanel panel;
61
    
62
    /** Creates new form PanelProjectLocationVisual */
63
    public SampleAppPanelVisual(SampleAppWizardPanel panel) {
64
        initComponents();
65
        this.panel = panel;
66
        // Register listener on the textFields to make the automatic updates
67
        projectNameTextField.getDocument().addDocumentListener(this);
68
        projectLocationTextField.getDocument().addDocumentListener(this);
69
    }
70
    
71
    
72
    public String getProjectName() {
73
        return this.projectNameTextField.getText();
74
    }
75
    
76
    /** This method is called from within the constructor to
77
     * initialize the form.
78
     * WARNING: Do NOT modify this code. The content of this method is
79
     * always regenerated by the Form Editor.
80
     */
81
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
82
    private void initComponents() {
83
84
        projectNameLabel = new javax.swing.JLabel();
85
        projectNameTextField = new javax.swing.JTextField();
86
        projectLocationLabel = new javax.swing.JLabel();
87
        projectLocationTextField = new javax.swing.JTextField();
88
        browseButton = new javax.swing.JButton();
89
        createdFolderLabel = new javax.swing.JLabel();
90
        createdFolderTextField = new javax.swing.JTextField();
91
92
        projectNameLabel.setLabelFor(projectNameTextField);
93
        org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.project_name")); // NOI18N
94
95
        projectLocationLabel.setLabelFor(projectLocationTextField);
96
        org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.project_location")); // NOI18N
97
98
        org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.browse")); // NOI18N
99
        browseButton.addActionListener(new java.awt.event.ActionListener() {
100
            public void actionPerformed(java.awt.event.ActionEvent evt) {
101
                browseButtonActionPerformed(evt);
102
            }
103
        });
104
105
        createdFolderLabel.setLabelFor(createdFolderTextField);
106
        org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.project_folder")); // NOI18N
107
108
        createdFolderTextField.setEditable(false);
109
110
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
111
        this.setLayout(layout);
112
        layout.setHorizontalGroup(
113
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
114
            .addGroup(layout.createSequentialGroup()
115
                .addContainerGap()
116
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
117
                    .addComponent(projectNameLabel)
118
                    .addComponent(projectLocationLabel)
119
                    .addComponent(createdFolderLabel))
120
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
121
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122
                    .addComponent(projectNameTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
123
                    .addComponent(projectLocationTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
124
                    .addComponent(createdFolderTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))
125
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
126
                .addComponent(browseButton)
127
                .addContainerGap())
128
        );
129
        layout.setVerticalGroup(
130
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
131
            .addGroup(layout.createSequentialGroup()
132
                .addContainerGap()
133
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
134
                    .addComponent(projectNameLabel)
135
                    .addComponent(projectNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
136
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
137
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
138
                    .addComponent(projectLocationLabel)
139
                    .addComponent(projectLocationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
140
                    .addComponent(browseButton))
141
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
142
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
143
                    .addComponent(createdFolderLabel)
144
                    .addComponent(createdFolderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
145
                .addContainerGap(213, Short.MAX_VALUE))
146
        );
147
    }// </editor-fold>//GEN-END:initComponents
148
    
149
    private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
150
            JFileChooser chooser = new JFileChooser();
151
            FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
152
            chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.select_project_location"));
153
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
154
            String path = this.projectLocationTextField.getText();
155
            if (path.length() > 0) {
156
                File f = new File(path);
157
                if (f.exists()) {
158
                    chooser.setSelectedFile(f);
159
                }
160
            }
161
            if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
162
                File projectDir = chooser.getSelectedFile();
163
                projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
164
            }
165
            panel.fireChangeEvent();
166
        
167
    }//GEN-LAST:event_browseButtonActionPerformed
168
    
169
    
170
    // Variables declaration - do not modify//GEN-BEGIN:variables
171
    private javax.swing.JButton browseButton;
172
    private javax.swing.JLabel createdFolderLabel;
173
    private javax.swing.JTextField createdFolderTextField;
174
    private javax.swing.JLabel projectLocationLabel;
175
    private javax.swing.JTextField projectLocationTextField;
176
    private javax.swing.JLabel projectNameLabel;
177
    private javax.swing.JTextField projectNameTextField;
178
    // End of variables declaration//GEN-END:variables
179
    
180
    @Override
181
    public void addNotify() {
182
        super.addNotify();
183
        //same problem as in 31086, initial focus on Cancel button
184
        projectNameTextField.requestFocus();
185
    }
186
    
187
    boolean valid(WizardDescriptor wizardDescriptor) {
188
        
189
        if (projectNameTextField.getText().length() == 0) {
190
            wizardDescriptor.putProperty(WIZARD_PANEL_ERROR_MESSAGE,
191
                    org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.invalid_folder_name"));
192
            return false; // Display name not specified
193
        }
194
        File f = FileUtil.normalizeFile(new File(projectLocationTextField.getText()).getAbsoluteFile());
195
        if (!f.isDirectory()) {
196
            String message = org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.invalid_path");
197
            wizardDescriptor.putProperty(WIZARD_PANEL_ERROR_MESSAGE, message);
198
            return false;
199
        }
200
        final File destFolder = FileUtil.normalizeFile(new File(createdFolderTextField.getText()).getAbsoluteFile());
201
        
202
        File projLoc = destFolder;
203
        while (projLoc != null && !projLoc.exists()) {
204
            projLoc = projLoc.getParentFile();
205
        }
206
        if (projLoc == null || !projLoc.canWrite()) {
207
            wizardDescriptor.putProperty(WIZARD_PANEL_ERROR_MESSAGE,
208
                    org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.folder_creation_error"));
209
            return false;
210
        }
211
        
212
        if (FileUtil.toFileObject(projLoc) == null) {
213
            String message = org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.invalid_path");
214
            wizardDescriptor.putProperty(WIZARD_PANEL_ERROR_MESSAGE, message);
215
            return false;
216
        }
217
        
218
        File[] kids = destFolder.listFiles();
219
        if (destFolder.exists() && kids != null && kids.length > 0) {
220
            // Folder exists and is not empty
221
            wizardDescriptor.putProperty(WIZARD_PANEL_ERROR_MESSAGE,
222
                    org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.folder_exists"));
223
            return false;
224
        }
225
        wizardDescriptor.putProperty(WIZARD_PANEL_ERROR_MESSAGE, "");
226
        return true;
227
    }
228
    
229
    void store(WizardDescriptor d) {
230
        String name = projectNameTextField.getText().trim();
231
        String folder = createdFolderTextField.getText().trim();
232
        
233
        d.putProperty("projdir", new File(folder)); // NOI18N
234
        d.putProperty("name", name); // NOI18N
235
    }
236
    
237
    void read(WizardDescriptor settings) {
238
        File projectLocation = (File) settings.getProperty("projdir"); // NOI18N
239
        if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
240
            projectLocation = ProjectChooser.getProjectsFolder();
241
        } else {
242
            projectLocation = projectLocation.getParentFile();
243
        }
244
        this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
245
        
246
        String projectName = (String) settings.getProperty("name"); // NOI18N
247
        if(projectName == null) {
248
            projectName = org.openide.util.NbBundle.getMessage(SampleAppPanelVisual.class, "SampleAppPanelVisual.default_prj_name");
249
        }
250
        this.projectNameTextField.setText(projectName);
251
        this.projectNameTextField.selectAll();
252
    }
253
    
254
    void validate(WizardDescriptor d) throws WizardValidationException {
255
        // nothing to validate
256
    }
257
    
258
    // Implementation of DocumentListener --------------------------------------
259
    
260
    public void changedUpdate(DocumentEvent e) {
261
        updateTexts(e);
262
        if (this.projectNameTextField.getDocument() == e.getDocument()) {
263
            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
264
        }
265
    }
266
    
267
    public void insertUpdate(DocumentEvent e) {
268
        updateTexts(e);
269
        if (this.projectNameTextField.getDocument() == e.getDocument()) {
270
            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
271
        }
272
    }
273
    
274
    public void removeUpdate(DocumentEvent e) {
275
        updateTexts(e);
276
        if (this.projectNameTextField.getDocument() == e.getDocument()) {
277
            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
278
        }
279
    }
280
    
281
    /** Handles changes in the Project name and project directory, */
282
    private void updateTexts(DocumentEvent e) {
283
        
284
        Document doc = e.getDocument();
285
        
286
        if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) {
287
            // Change in the project name
288
            
289
            String projectName = projectNameTextField.getText();
290
            String projectFolder = projectLocationTextField.getText();
291
            
292
            //if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) {
293
            createdFolderTextField.setText(projectFolder + File.separatorChar + projectName);
294
            //}
295
            
296
        }
297
        panel.fireChangeEvent(); // Notify that the panel changed
298
    }
299
    
300
}
(-)e2a3e210c3db (+121 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.modules.apisupport.equinoxdemo;
42
43
import java.awt.Component;
44
import java.util.HashSet;
45
import java.util.Iterator;
46
import java.util.Set;
47
import javax.swing.event.ChangeEvent;
48
import javax.swing.event.ChangeListener;
49
import org.openide.WizardDescriptor;
50
import org.openide.util.HelpCtx;
51
import org.openide.util.NbBundle;
52
53
/**
54
 * Warning about the license.
55
 */
56
public class SampleAppWarningPanel
57
implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel {
58
    private WizardDescriptor wizardDescriptor;
59
    private SampleAppWarningVisual component;
60
    
61
    public SampleAppWarningPanel() {
62
    }
63
    
64
    @Override
65
    public Component getComponent() {
66
        if (component == null) {
67
            component = new SampleAppWarningVisual(this);
68
            component.setName(NbBundle.getMessage(SampleAppWarningPanel.class, "LBL_CreateProjectStep"));
69
        }
70
        return component;
71
    }
72
    
73
    @Override
74
    public HelpCtx getHelp() {
75
        return new HelpCtx(SampleAppWarningPanel.class);
76
    }
77
    
78
    @Override
79
    public boolean isValid() {
80
        getComponent();
81
        return component.valid(wizardDescriptor);
82
    }
83
    
84
    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(3);
85
    @Override
86
    public final void addChangeListener(ChangeListener l) {
87
        synchronized (listeners) {
88
            listeners.add(l);
89
        }
90
    }
91
    @Override
92
    public final void removeChangeListener(ChangeListener l) {
93
        synchronized (listeners) {
94
            listeners.remove(l);
95
        }
96
    }
97
    protected final void fireChangeEvent() {
98
        Iterator it;
99
        synchronized (listeners) {
100
            it = new HashSet<ChangeListener>(listeners).iterator();
101
        }
102
        ChangeEvent ev = new ChangeEvent(this);
103
        while (it.hasNext()) {
104
            ((ChangeListener) it.next()).stateChanged(ev);
105
        }
106
    }
107
    
108
    @Override
109
    public void readSettings(Object settings) {
110
    }
111
    
112
    @Override
113
    public void storeSettings(Object settings) {
114
    }
115
    
116
    @Override
117
    public boolean isFinishPanel() {
118
        return true;
119
    }
120
121
}
(-)e2a3e210c3db (+76 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Component id="readLicense" pref="384" max="32767" attributes="0"/>
22
              <EmptySpace max="-2" attributes="0"/>
23
          </Group>
24
          <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
25
              <Group type="102" alignment="0" attributes="0">
26
                  <EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
27
                  <Component id="info" min="-2" pref="373" max="-2" attributes="0"/>
28
                  <EmptySpace pref="14" max="32767" attributes="0"/>
29
              </Group>
30
          </Group>
31
      </Group>
32
    </DimensionLayout>
33
    <DimensionLayout dim="1">
34
      <Group type="103" groupAlignment="0" attributes="0">
35
          <Group type="102" alignment="1" attributes="0">
36
              <EmptySpace pref="219" max="32767" attributes="0"/>
37
              <Component id="readLicense" min="-2" pref="23" max="-2" attributes="0"/>
38
              <EmptySpace max="-2" attributes="0"/>
39
          </Group>
40
          <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
41
              <Group type="102" alignment="1" attributes="0">
42
                  <Component id="info" min="-2" pref="207" max="-2" attributes="0"/>
43
                  <EmptySpace pref="43" max="32767" attributes="0"/>
44
              </Group>
45
          </Group>
46
      </Group>
47
    </DimensionLayout>
48
  </Layout>
49
  <SubComponents>
50
    <Component class="javax.swing.JEditorPane" name="info">
51
      <Properties>
52
        <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
53
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="SampleAppWarningVisual.info.contentType" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
54
        </Property>
55
        <Property name="editable" type="boolean" value="false"/>
56
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
57
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="MSG_WARNING" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
58
        </Property>
59
        <Property name="opaque" type="boolean" value="false"/>
60
      </Properties>
61
      <Events>
62
        <EventHandler event="hyperlinkUpdate" listener="javax.swing.event.HyperlinkListener" parameters="javax.swing.event.HyperlinkEvent" handler="infoHyperlinkUpdate"/>
63
      </Events>
64
    </Component>
65
    <Component class="javax.swing.JCheckBox" name="readLicense">
66
      <Properties>
67
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
68
          <ResourceString bundle="org/netbeans/modules/apisupport/equinoxdemo/Bundle.properties" key="SampleAppWarningVisual.readLicense.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;, {arguments})"/>
69
        </Property>
70
      </Properties>
71
      <Events>
72
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="readLicenseActionPerformed"/>
73
      </Events>
74
    </Component>
75
  </SubComponents>
76
</Form>
(-)e2a3e210c3db (+140 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
/*
41
 * SampleAppWarningVisual.java
42
 *
43
 * Created on 16.2.2010, 15:07:58
44
 */
45
46
package org.netbeans.modules.apisupport.equinoxdemo;
47
48
import javax.swing.event.HyperlinkEvent;
49
import org.openide.WizardDescriptor;
50
import org.openide.awt.HtmlBrowser.URLDisplayer;
51
52
/**
53
 *
54
 * @author Jaroslav Tulach <jtulach@netbeans.org>
55
 */
56
class SampleAppWarningVisual extends javax.swing.JPanel {
57
    SampleAppWarningPanel panel;
58
    SampleAppWarningVisual(SampleAppWarningPanel panel) {
59
        this.panel = panel;
60
        initComponents();
61
    }
62
63
    /** This method is called from within the constructor to
64
     * initialize the form.
65
     * WARNING: Do NOT modify this code. The content of this method is
66
     * always regenerated by the Form Editor.
67
     */
68
    @SuppressWarnings("unchecked")
69
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
70
    private void initComponents() {
71
72
        info = new javax.swing.JEditorPane();
73
        readLicense = new javax.swing.JCheckBox();
74
75
        info.setContentType(org.openide.util.NbBundle.getMessage(SampleAppWarningVisual.class, "SampleAppWarningVisual.info.contentType", new Object[] {})); // NOI18N
76
        info.setEditable(false);
77
        info.setText(org.openide.util.NbBundle.getMessage(SampleAppWarningVisual.class, "MSG_WARNING", new Object[] {})); // NOI18N
78
        info.setOpaque(false);
79
        info.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
80
            public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {
81
                infoHyperlinkUpdate(evt);
82
            }
83
        });
84
85
        readLicense.setText(org.openide.util.NbBundle.getMessage(SampleAppWarningVisual.class, "SampleAppWarningVisual.readLicense.text", new Object[] {})); // NOI18N
86
        readLicense.addActionListener(new java.awt.event.ActionListener() {
87
            public void actionPerformed(java.awt.event.ActionEvent evt) {
88
                readLicenseActionPerformed(evt);
89
            }
90
        });
91
92
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
93
        this.setLayout(layout);
94
        layout.setHorizontalGroup(
95
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
96
            .addGroup(layout.createSequentialGroup()
97
                .addContainerGap()
98
                .addComponent(readLicense, javax.swing.GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)
99
                .addContainerGap())
100
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
101
                .addGroup(layout.createSequentialGroup()
102
                    .addGap(13, 13, 13)
103
                    .addComponent(info, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE)
104
                    .addContainerGap(14, Short.MAX_VALUE)))
105
        );
106
        layout.setVerticalGroup(
107
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
108
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
109
                .addContainerGap(219, Short.MAX_VALUE)
110
                .addComponent(readLicense, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
111
                .addContainerGap())
112
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
114
                    .addComponent(info, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
115
                    .addContainerGap(43, Short.MAX_VALUE)))
116
        );
117
    }// </editor-fold>//GEN-END:initComponents
118
119
    private void readLicenseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readLicenseActionPerformed
120
        panel.fireChangeEvent();
121
    }//GEN-LAST:event_readLicenseActionPerformed
122
123
    private void infoHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_infoHyperlinkUpdate
124
        if (HyperlinkEvent.EventType.ACTIVATED == evt.getEventType()) {
125
            URLDisplayer.getDefault().showURLExternal(evt.getURL());
126
        }
127
    }//GEN-LAST:event_infoHyperlinkUpdate
128
129
    boolean valid(WizardDescriptor wizardDescriptor) {
130
        return readLicense.isSelected();
131
    }
132
133
134
    // Variables declaration - do not modify//GEN-BEGIN:variables
135
    private javax.swing.JEditorPane info;
136
    private javax.swing.JCheckBox readLicense;
137
    // End of variables declaration//GEN-END:variables
138
139
140
}
(-)e2a3e210c3db (+208 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.modules.apisupport.equinoxdemo;
42
43
import java.awt.Component;
44
import java.io.File;
45
import java.io.IOException;
46
import java.io.InputStream;
47
import java.io.OutputStream;
48
import java.util.Enumeration;
49
import java.util.LinkedHashSet;
50
import java.util.NoSuchElementException;
51
import java.util.Set;
52
import java.util.zip.ZipEntry;
53
import java.util.zip.ZipInputStream;
54
import javax.swing.JComponent;
55
import javax.swing.event.ChangeListener;
56
import org.netbeans.api.project.ProjectManager;
57
import org.netbeans.spi.project.ui.support.ProjectChooser;
58
import org.netbeans.spi.project.ui.templates.support.Templates;
59
import org.openide.WizardDescriptor;
60
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.util.NbBundle;
63
64
public class SampleAppWizardIterator implements WizardDescriptor.InstantiatingIterator {
65
    
66
    private static final long serialVersionUID = 1L;
67
    
68
    private transient int index;
69
    private transient WizardDescriptor.Panel[] panels;
70
    private transient WizardDescriptor wiz;
71
    
72
    public SampleAppWizardIterator() {}
73
    
74
    public static SampleAppWizardIterator createIterator() {
75
        return new SampleAppWizardIterator();
76
    }
77
    
78
    private WizardDescriptor.Panel[] createPanels() {
79
        return new WizardDescriptor.Panel[] {
80
            new SampleAppWizardPanel(),
81
            new SampleAppWarningPanel()
82
        };
83
    }
84
    
85
    private String[] createSteps() {
86
        return new String[] {
87
            NbBundle.getMessage(SampleAppWizardIterator.class, "LBL_CreateProjectStep"),
88
            NbBundle.getMessage(SampleAppWizardIterator.class, "LBL_DownloadStep")
89
        };
90
    }
91
    
92
    public Set/*<FileObject>*/ instantiate() throws IOException {
93
        Set resultSet = new LinkedHashSet();
94
        File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir")); // NOI18N
95
        dirF.mkdirs();
96
        
97
        FileObject template = Templates.getTemplate(wiz);
98
        FileObject dir = FileUtil.toFileObject(dirF);
99
        unZipFile(template.getInputStream(), dir);
100
        
101
        // Always open top dir as a project:
102
        resultSet.add(dir);
103
        // Look for nested projects to open as well:
104
        Enumeration e = dir.getFolders(true);
105
        while (e.hasMoreElements()) {
106
            FileObject subfolder = (FileObject) e.nextElement();
107
            if (ProjectManager.getDefault().isProject(subfolder)) {
108
                resultSet.add(subfolder);
109
            }
110
        }
111
        
112
        File parent = dirF.getParentFile();
113
        if (parent != null && parent.exists()) {
114
            ProjectChooser.setProjectsFolder(parent);
115
        }
116
        
117
        return resultSet;
118
    }
119
    
120
    public void initialize(WizardDescriptor wiz) {
121
        this.wiz = wiz;
122
        index = 0;
123
        panels = createPanels();
124
        // Make sure list of steps is accurate.
125
        String[] steps = createSteps();
126
        for (int i = 0; i < panels.length; i++) {
127
            Component c = panels[i].getComponent();
128
            if (steps[i] == null) {
129
                // Default step name to component name of panel.
130
                // Mainly useful for getting the name of the target
131
                // chooser to appear in the list of steps.
132
                steps[i] = c.getName();
133
            }
134
            if (c instanceof JComponent) { // assume Swing components
135
                JComponent jc = (JComponent) c;
136
                // Step #.
137
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, new Integer(i)); // NOI18N
138
                // Step name (actually the whole list for reference).
139
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); // NOI18N
140
            }
141
        }
142
    }
143
    
144
    public void uninitialize(WizardDescriptor wiz) {
145
        this.wiz.putProperty("projdir",null); // NOI18N
146
        this.wiz.putProperty("name",null); // NOI18N
147
        this.wiz = null;
148
        panels = null;
149
    }
150
    
151
    public String name() {
152
        return NbBundle.getMessage(SampleAppWizardIterator.class, "SampleAppWizardIterator.name.format",
153
                new Object[] {new Integer(index + 1), new Integer(panels.length)});
154
    }
155
    
156
    public boolean hasNext() {
157
        return index < panels.length - 1;
158
    }
159
    
160
    public boolean hasPrevious() {
161
        return index > 0;
162
    }
163
    
164
    public void nextPanel() {
165
        if (!hasNext()) {
166
            throw new NoSuchElementException();
167
        }
168
        index++;
169
    }
170
    
171
    public void previousPanel() {
172
        if (!hasPrevious()) {
173
            throw new NoSuchElementException();
174
        }
175
        index--;
176
    }
177
    
178
    public WizardDescriptor.Panel current() {
179
        return panels[index];
180
    }
181
    
182
    // If nothing unusual changes in the middle of the wizard, simply:
183
    public final void addChangeListener(ChangeListener l) {}
184
    public final void removeChangeListener(ChangeListener l) {}
185
    
186
    private static void unZipFile(InputStream source, FileObject projectRoot) throws IOException {
187
        try {
188
            ZipInputStream str = new ZipInputStream(source);
189
            ZipEntry entry;
190
            while ((entry = str.getNextEntry()) != null) {
191
                if (entry.isDirectory()) {
192
                    FileUtil.createFolder(projectRoot, entry.getName());
193
                } else {
194
                    FileObject fo = FileUtil.createData(projectRoot, entry.getName());
195
                    OutputStream out = fo.getOutputStream();
196
                    try {
197
                        FileUtil.copy(str, out);
198
                    } finally {
199
                        out.close();
200
                    }
201
                }
202
            }
203
        } finally {
204
            source.close();
205
        }
206
    }
207
    
208
}
(-)e2a3e210c3db (+132 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.modules.apisupport.equinoxdemo;
42
43
import java.awt.Component;
44
import java.util.HashSet;
45
import java.util.Iterator;
46
import java.util.Set;
47
import javax.swing.event.ChangeEvent;
48
import javax.swing.event.ChangeListener;
49
import org.openide.WizardDescriptor;
50
import org.openide.WizardValidationException;
51
import org.openide.util.HelpCtx;
52
import org.openide.util.NbBundle;
53
54
/**
55
 * Panel just asking for basic info.
56
 */
57
class SampleAppWizardPanel implements WizardDescriptor.Panel,
58
        WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel {
59
    
60
    private WizardDescriptor wizardDescriptor;
61
    private SampleAppPanelVisual component;
62
    
63
    public SampleAppWizardPanel() {
64
    }
65
    
66
    @Override
67
    public Component getComponent() {
68
        if (component == null) {
69
            component = new SampleAppPanelVisual(this);
70
            component.setName(NbBundle.getMessage(SampleAppWizardPanel.class, "LBL_CreateProjectStep"));
71
        }
72
        return component;
73
    }
74
    
75
    @Override
76
    public HelpCtx getHelp() {
77
        return new HelpCtx(SampleAppWizardPanel.class);
78
    }
79
    
80
    @Override
81
    public boolean isValid() {
82
        getComponent();
83
        return component.valid(wizardDescriptor);
84
    }
85
    
86
    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
87
    public final void addChangeListener(ChangeListener l) {
88
        synchronized (listeners) {
89
            listeners.add(l);
90
        }
91
    }
92
    @Override
93
    public final void removeChangeListener(ChangeListener l) {
94
        synchronized (listeners) {
95
            listeners.remove(l);
96
        }
97
    }
98
    protected final void fireChangeEvent() {
99
        Iterator it;
100
        synchronized (listeners) {
101
            it = new HashSet(listeners).iterator();
102
        }
103
        ChangeEvent ev = new ChangeEvent(this);
104
        while (it.hasNext()) {
105
            ((ChangeListener) it.next()).stateChanged(ev);
106
        }
107
    }
108
    
109
    @Override
110
    public void readSettings(Object settings) {
111
        wizardDescriptor = (WizardDescriptor) settings;
112
        component.read(wizardDescriptor);
113
    }
114
    
115
    @Override
116
    public void storeSettings(Object settings) {
117
        WizardDescriptor d = (WizardDescriptor) settings;
118
        component.store(d);
119
    }
120
    
121
    @Override
122
    public boolean isFinishPanel() {
123
        return false;
124
    }
125
    
126
    @Override
127
    public void validate() throws WizardValidationException {
128
        getComponent();
129
        component.validate(wizardDescriptor);
130
    }
131
    
132
}
(-)e2a3e210c3db (+61 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
3
<!--
4
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
6
Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
7
8
9
The contents of this file are subject to the terms of either the GNU
10
General Public License Version 2 only ("GPL") or the Common
11
Development and Distribution License("CDDL") (collectively, the
12
"License"). You may not use this file except in compliance with the
13
License. You can obtain a copy of the License at
14
http://www.netbeans.org/cddl-gplv2.html
15
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
specific language governing permissions and limitations under the
17
License.  When distributing the software, include this License Header
18
Notice in each file and include the License file at
19
nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
20
particular file as subject to the "Classpath" exception as provided
21
by Sun in the GPL Version 2 section of the License file that
22
accompanied this code. If applicable, add the following below the
23
License Header, with the fields enclosed by brackets [] replaced by
24
your own identifying information:
25
"Portions Copyrighted [year] [name of copyright owner]"
26
27
Contributor(s):
28
29
The Original Software is NetBeans. The Initial Developer of the Original
30
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31
Microsystems, Inc. All Rights Reserved.
32
33
If you wish your version of this file to be governed by only the CDDL
34
or only the GPL Version 2, indicate your decision by adding
35
"[Contributor] elects to include this software in this distribution
36
under the [CDDL or GPL Version 2] license." If you do not indicate a
37
single choice of license, a recipient has the option to distribute
38
your version of this file under either the CDDL, the GPL Version 2 or
39
to extend the choice of license to its licensees as provided above.
40
However, if you add GPL Version 2 code and therefore, elected the GPL
41
Version 2 license, then the option applies only if the new code is
42
made subject to such option by the copyright holder.
43
-->
44
<filesystem>
45
    <folder name="Templates">
46
        <folder name="Project">
47
            <folder name="Samples">
48
                <folder name="ApiSupport">
49
                    <file name="EquinoxDemo.zip" url="EquinoxDemo.zip">
50
                        <attr name="position" intvalue="9900"/>
51
                        <attr name="iconBase" stringvalue="org/netbeans/modules/apisupport/equinoxdemo/bundle.png"/>
52
                        <attr name="displayName" bundlevalue="org.netbeans.modules.apisupport.equinoxdemo.Bundle#SampleAppFile"/>
53
                        <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.apisupport.equinoxdemo.SampleAppWizardIterator.createIterator"/>
54
                        <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/apisupport/equinoxdemo/SampleAppDescription.html"/>
55
                        <attr name="template" boolvalue="true"/>
56
                    </file>
57
                </folder>
58
            </folder>
59
        </folder>
60
    </folder>
61
</filesystem>
(-)e2a3e210c3db (+176 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.modules.apisupport.equinoxdemo;
42
43
import java.io.File;
44
import java.io.FilenameFilter;
45
import java.io.InputStream;
46
import java.util.Properties;
47
import org.apache.tools.ant.module.api.support.ActionUtils;
48
import org.netbeans.api.project.ProjectManager;
49
import org.netbeans.modules.apisupport.project.DialogDisplayerImpl;
50
import org.netbeans.modules.apisupport.project.InstalledFileLocatorImpl;
51
import org.netbeans.modules.apisupport.project.TestAntLogger;
52
import org.netbeans.modules.apisupport.project.TestBase;
53
import org.netbeans.modules.apisupport.project.layers.LayerTestBase;
54
import org.netbeans.modules.apisupport.project.suite.SuiteProject;
55
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper;
56
import org.openide.DialogDescriptor;
57
import org.openide.execution.ExecutorTask;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
60
61
/**
62
 * Invokes various Ant targets over equinoxdemo sample.
63
 *
64
 * @author Tomas Musil
65
 */
66
public class BuildEquinoxSampleApplicationTest extends TestBase {
67
68
    private File sampleFolder = null;
69
70
    static {
71
        // #65461: do not try to load ModuleInfo instances from ant module
72
        System.setProperty("org.netbeans.core.startup.ModuleSystem.CULPRIT", "true");
73
        LayerTestBase.Lkp.setLookup(new Object[0]);
74
        DialogDisplayerImpl.returnFromNotify(DialogDescriptor.NO_OPTION);
75
    }
76
77
    public BuildEquinoxSampleApplicationTest(String testName) {
78
        super(testName);
79
    }
80
81
    @Override
82
    protected void setUp() throws Exception {
83
        clearWorkDir();
84
        noDataDir = true;
85
        super.setUp();
86
        InstalledFileLocatorImpl.registerDestDir(destDirF);
87
        TestAntLogger.getDefault().setEnabled(true);
88
    }
89
90
    @Override
91
    protected void tearDown() throws Exception {
92
        TestAntLogger.getDefault().setEnabled(false);
93
    }
94
95
    public int runAntTargetsOnSample(String[] targets) throws Exception {
96
        InputStream is = getClass().getClassLoader().getResourceAsStream("org/netbeans/modules/apisupport/equinoxdemo/EquinoxDemo.zip");
97
        assertNotNull(is);
98
        sampleFolder = new File(getWorkDir(), "sample");
99
        sampleFolder.mkdir();
100
        FileObject fo = FileUtil.toFileObject(sampleFolder);
101
        assertNotNull(fo);
102
103
104
        try {
105
            FileUtil.extractJar(fo, is);
106
        } finally {
107
            is.close();
108
        }
109
110
        File buildProps = new File(getWorkDir(), "build.properties");
111
        File privateFolder = new File(new File(sampleFolder, "nbproject"), "private");
112
        privateFolder.mkdir();
113
114
        FileObject platfPrivateProps = FileUtil.copyFile(FileUtil.toFileObject(buildProps), FileUtil.toFileObject(privateFolder), "platform-private");
115
        assertNotNull(platfPrivateProps);
116
        SuiteProject sampleSuite = (SuiteProject) ProjectManager.getDefault().findProject(fo);
117
        assertNotNull(sampleSuite);
118
        FileObject buildScript = sampleSuite.getProjectDirectory().getFileObject(GeneratedFilesHelper.BUILD_XML_PATH);
119
        assertNotNull(buildScript);
120
        assertTrue(buildScript.isValid());
121
        Properties props = new Properties();
122
        File toplinkJar1 = new File(destDirF, "java/modules/ext/toplink/toplink-essentials.jar");
123
        assertTrue(toplinkJar1.getAbsolutePath(), toplinkJar1.isFile());
124
        File toplinkJar2 = new File(destDirF, "java/modules/ext/toplink/toplink-essentials-agent.jar");
125
        assertTrue(toplinkJar2.getAbsolutePath(), toplinkJar2.isFile());
126
        props.setProperty("libs.toplink.classpath", "" + toplinkJar1 + File.pathSeparator + toplinkJar2);
127
128
        System.out.println("------------- BUILD OUTPUT --------------");
129
        ExecutorTask et = ActionUtils.runTarget(buildScript, targets, props);
130
        et.waitFinished();
131
        System.out.println("-----------------------------------------");
132
        return et.result();
133
    }
134
135
    public void testBuildZip() throws Exception {
136
        int ret = runAntTargetsOnSample(new String[]{"build-zip"});
137
        assertEquals("build-zipant target should return zero - build successful", 0, ret);
138
        File dist = new File(sampleFolder, "dist");
139
        File zipFile = new File(dist, "equinoxsample.zip");
140
        assertTrue("ZIP file should be in dist folder", zipFile.exists());
141
    }
142
143
    public void testBuild() throws Exception {
144
        int ret = runAntTargetsOnSample(new String[] {"build"});
145
        assertEquals("build ant target should return zero - build successful", 0 , ret);
146
        File buildFolder = new File(sampleFolder,"build");
147
        assertTrue("build folder should exist", buildFolder.exists() && buildFolder.isDirectory());
148
        String[] children = buildFolder.list();
149
        assertTrue("build folder is not empty", children.length>0);
150
151
    }
152
153
    public void testBuildNBMs() throws Exception {
154
        int ret = runAntTargetsOnSample(new String[] {"nbms"});
155
        assertEquals("build ant target should return zero - build successful", 0 , ret);
156
        File buildFolder = new File(sampleFolder,"build");
157
        File updatesFolder = new File(buildFolder,"updates");
158
        assertTrue("build/update folder exists", updatesFolder.exists() && updatesFolder.isDirectory());
159
        File showBundles = new File(updatesFolder, "org-apidesign-netbinox-showbundles.nbm");
160
        assertTrue("Our NBM is in build/updates folder", showBundles.exists());
161
        assertEquals("1 nbm is in build/updates folder", 1, updatesFolder.list(new FilenameFilter() {
162
            public boolean accept(File dir, String name) {
163
                return name.indexOf("nbm") != -1;
164
            }
165
        }).length);
166
    }
167
168
    public void testClean() throws Exception {
169
        int ret = runAntTargetsOnSample(new String[]{"clean"});
170
        assertEquals("clean ant target should return zero - build successful", 0, ret);
171
        File buildFolder = new File(sampleFolder, "build");
172
        File distFolder = new File(sampleFolder, "dist");
173
        assertTrue("build and dist folders are deleted", !distFolder.exists() && !buildFolder.exists());
174
    }
175
}
176

Return to bug 180791