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 144060
Collapse All | Expand All

(-)a/apisupport.project/apichanges.xml (+16 lines)
Lines 107-112 Link Here
107
    <changes>
107
    <changes>
108
        <change>
108
        <change>
109
            <api name="apisupport_spi"/>
109
            <api name="apisupport_spi"/>
110
            <summary>Introduced ModuleTypePanel</summary>
111
            <version major="1" minor="23"/>
112
            <date day="29" month="8" year="2008"/>
113
            <author login="akorostelev"/>
114
            <compatibility addition="yes"/>
115
            <description>
116
                Adding <code>ModuleTypePanel</code> class to create 
117
                UI Panel for selecting module type (Standalone or added to Suite),
118
                NetBeans Platform (for standalone modules),
119
                Module Suite (for module added to Suite).
120
                And to communicate with created panel through WizardDescriptor.
121
            </description>
122
        </change>
123
        
124
        <change>
125
            <api name="apisupport_spi"/>
110
            <summary>Introduced NodeFactoryUtils</summary>
126
            <summary>Introduced NodeFactoryUtils</summary>
111
            <version major="1" minor="16"/>
127
            <version major="1" minor="16"/>
112
            <date day="15" month="3" year="2007"/>
128
            <date day="15" month="3" year="2007"/>
(-)a/apisupport.project/nbproject/project.properties (-1 / +1 lines)
Lines 39-45 Link Here
39
39
40
javac.compilerargs=-Xlint -Xlint:-serial
40
javac.compilerargs=-Xlint -Xlint:-serial
41
javac.source=1.5
41
javac.source=1.5
42
spec.version.base=1.22.0
42
spec.version.base=1.23.0
43
43
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
(-)a/apisupport.project/nbproject/project.xml (+2 lines)
Lines 447-453 Link Here
447
            <friend-packages>
447
            <friend-packages>
448
                <friend>org.codehaus.mevenide.netbeans.apisupport</friend>
448
                <friend>org.codehaus.mevenide.netbeans.apisupport</friend>
449
                <friend>org.netbeans.modules.maven.apisupport</friend>
449
                <friend>org.netbeans.modules.maven.apisupport</friend>
450
                <friend>org.netbeans.modules.vmd.componentssupport</friend>
450
                <package>org.netbeans.modules.apisupport.project.spi</package>
451
                <package>org.netbeans.modules.apisupport.project.spi</package>
452
                <package>org.netbeans.modules.apisupport.project.ui.wizard.spi</package>
451
            </friend-packages>
453
            </friend-packages>
452
        </data>
454
        </data>
453
    </configuration>
455
    </configuration>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/BasicInfoVisualPanel.form (-142 / +75 lines)
Lines 1-12 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
4
  <NonVisualComponents>
5
    <Component class="javax.swing.ButtonGroup" name="moduleTypeGroup">
5
    <Component class="javax.swing.ButtonGroup" name="moduleTypeGroup">
6
    </Component>
6
    </Component>
7
  </NonVisualComponents>
7
  </NonVisualComponents>
8
  <AccessibilityProperties>
9
    <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
10
      <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_BasicInfoVisualPanel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
11
    </Property>
12
    <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
13
      <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_BasicInfoVisualPanel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
14
    </Property>
15
  </AccessibilityProperties>
8
  <AuxValues>
16
  <AuxValues>
9
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
17
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
18
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
10
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
19
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
11
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
20
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
21
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
Lines 75-80 Link Here
75
          <Properties>
84
          <Properties>
76
            <Property name="horizontalAlignment" type="int" value="2"/>
85
            <Property name="horizontalAlignment" type="int" value="2"/>
77
          </Properties>
86
          </Properties>
87
          <AccessibilityProperties>
88
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
89
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_NameValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
90
            </Property>
91
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
92
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_NameValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
93
            </Property>
94
          </AccessibilityProperties>
78
          <AuxValues>
95
          <AuxValues>
79
            <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
96
            <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
80
          </AuxValues>
97
          </AuxValues>
Lines 88-93 Link Here
88
          <Properties>
105
          <Properties>
89
            <Property name="horizontalAlignment" type="int" value="2"/>
106
            <Property name="horizontalAlignment" type="int" value="2"/>
90
          </Properties>
107
          </Properties>
108
          <AccessibilityProperties>
109
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
110
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_LocationValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
111
            </Property>
112
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
113
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_LocationValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
114
            </Property>
115
          </AccessibilityProperties>
91
          <Constraints>
116
          <Constraints>
92
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
117
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
93
              <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
118
              <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
Lines 100-105 Link Here
100
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_BrowseButton_o" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
125
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_BrowseButton_o" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
101
            </Property>
126
            </Property>
102
          </Properties>
127
          </Properties>
128
          <AccessibilityProperties>
129
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
130
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_BrowseButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
131
            </Property>
132
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
133
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_BrowseButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
134
            </Property>
135
          </AccessibilityProperties>
103
          <Events>
136
          <Events>
104
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseLocation"/>
137
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseLocation"/>
105
          </Events>
138
          </Events>
Lines 120-125 Link Here
120
          <Properties>
153
          <Properties>
121
            <Property name="editable" type="boolean" value="false"/>
154
            <Property name="editable" type="boolean" value="false"/>
122
          </Properties>
155
          </Properties>
156
          <AccessibilityProperties>
157
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
158
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_FolderValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
159
            </Property>
160
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
161
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_FolderValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
162
            </Property>
163
          </AccessibilityProperties>
123
          <Constraints>
164
          <Constraints>
124
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
165
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
125
              <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
166
              <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
Lines 142-147 Link Here
142
          </Constraints>
183
          </Constraints>
143
        </Component>
184
        </Component>
144
        <Component class="javax.swing.JComboBox" name="suitePlatformValue">
185
        <Component class="javax.swing.JComboBox" name="suitePlatformValue">
186
          <AccessibilityProperties>
187
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
188
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_SuitePlatformValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
189
            </Property>
190
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
191
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_SuitePlatformValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
192
            </Property>
193
          </AccessibilityProperties>
145
          <AuxValues>
194
          <AuxValues>
146
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="PlatformComponentFactory.getNbPlatformsComboxBox();"/>
195
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="PlatformComponentFactory.getNbPlatformsComboxBox();"/>
147
          </AuxValues>
196
          </AuxValues>
Lines 157-162 Link Here
157
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_ManagePlatforms_g" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
206
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_ManagePlatforms_g" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
158
            </Property>
207
            </Property>
159
          </Properties>
208
          </Properties>
209
          <AccessibilityProperties>
210
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
211
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_ManageSuitePlatform" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
212
            </Property>
213
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
214
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_ManageSuitePlatform" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
215
            </Property>
216
          </AccessibilityProperties>
160
          <Events>
217
          <Events>
161
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="manageSuitePlatformActionPerformed"/>
218
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="manageSuitePlatformActionPerformed"/>
162
          </Events>
219
          </Events>
Lines 182-187 Link Here
182
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_SetAsMainProject" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
239
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_SetAsMainProject" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
183
        </Property>
240
        </Property>
184
      </Properties>
241
      </Properties>
242
      <AccessibilityProperties>
243
        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
244
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_MainProject" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
245
        </Property>
246
        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
247
          <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_MainProject" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
248
        </Property>
249
      </AccessibilityProperties>
185
      <Events>
250
      <Events>
186
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mainProjectActionPerformed"/>
251
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mainProjectActionPerformed"/>
187
      </Events>
252
      </Events>
Lines 191-337 Link Here
191
        </Constraint>
256
        </Constraint>
192
      </Constraints>
257
      </Constraints>
193
    </Component>
258
    </Component>
194
    <Container class="javax.swing.JPanel" name="typeChooserPanel">
195
      <Constraints>
196
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
197
          <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
198
        </Constraint>
199
      </Constraints>
200
201
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
202
      <SubComponents>
203
        <Component class="javax.swing.JRadioButton" name="standAloneModule">
204
          <Properties>
205
            <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
206
              <ComponentRef name="moduleTypeGroup"/>
207
            </Property>
208
            <Property name="selected" type="boolean" value="true"/>
209
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
210
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_StandaloneModule" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
211
            </Property>
212
          </Properties>
213
          <Events>
214
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="typeChanged"/>
215
          </Events>
216
          <Constraints>
217
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
218
              <GridBagConstraints gridX="0" gridY="0" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
219
            </Constraint>
220
          </Constraints>
221
        </Component>
222
        <Component class="javax.swing.JLabel" name="platform">
223
          <Properties>
224
            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
225
              <ComponentRef name="platformValue"/>
226
            </Property>
227
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
228
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="LBL_NetBeansPlatform" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
229
            </Property>
230
          </Properties>
231
          <Constraints>
232
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
233
              <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="18" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
234
            </Constraint>
235
          </Constraints>
236
        </Component>
237
        <Component class="javax.swing.JComboBox" name="platformValue">
238
          <Events>
239
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="platformChosen"/>
240
          </Events>
241
          <AuxValues>
242
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="PlatformComponentFactory.getNbPlatformsComboxBox();"/>
243
          </AuxValues>
244
          <Constraints>
245
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
246
              <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
247
            </Constraint>
248
          </Constraints>
249
        </Component>
250
        <Component class="javax.swing.JButton" name="managePlatform">
251
          <Properties>
252
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
253
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_ManagePlatforms_g" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
254
            </Property>
255
          </Properties>
256
          <Events>
257
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="managePlatformActionPerformed"/>
258
          </Events>
259
          <Constraints>
260
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
261
              <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
262
            </Constraint>
263
          </Constraints>
264
        </Component>
265
        <Component class="javax.swing.JRadioButton" name="suiteComponent">
266
          <Properties>
267
            <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
268
              <ComponentRef name="moduleTypeGroup"/>
269
            </Property>
270
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
271
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_AddToModuleSuite" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
272
            </Property>
273
          </Properties>
274
          <Events>
275
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="typeChanged"/>
276
          </Events>
277
          <Constraints>
278
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
279
              <GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="18" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
280
            </Constraint>
281
          </Constraints>
282
        </Component>
283
        <Component class="javax.swing.JLabel" name="moduleSuite">
284
          <Properties>
285
            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
286
              <ComponentRef name="moduleSuiteValue"/>
287
            </Property>
288
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
289
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="LBL_ModuleSuite" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
290
            </Property>
291
          </Properties>
292
          <Constraints>
293
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
294
              <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="18" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
295
            </Constraint>
296
          </Constraints>
297
        </Component>
298
        <Component class="javax.swing.JComboBox" name="moduleSuiteValue">
299
          <Events>
300
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moduleSuiteChosen"/>
301
          </Events>
302
          <AuxValues>
303
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="PlatformComponentFactory.getSuitesComboBox();"/>
304
          </AuxValues>
305
          <Constraints>
306
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
307
              <GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
308
            </Constraint>
309
          </Constraints>
310
        </Component>
311
        <Component class="javax.swing.JButton" name="browseSuiteButton">
312
          <Properties>
313
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
314
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_BrowseButton_w" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
315
            </Property>
316
          </Properties>
317
          <Events>
318
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseModuleSuite"/>
319
          </Events>
320
          <Constraints>
321
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
322
              <GridBagConstraints gridX="2" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
323
            </Constraint>
324
          </Constraints>
325
        </Component>
326
        <Component class="javax.swing.JLabel" name="chooserFiller">
327
          <Constraints>
328
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
329
              <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/>
330
            </Constraint>
331
          </Constraints>
332
        </Component>
333
      </SubComponents>
334
    </Container>
335
    <Container class="javax.swing.JPanel" name="pnlThouShaltBeholdLayout">
259
    <Container class="javax.swing.JPanel" name="pnlThouShaltBeholdLayout">
336
      <Constraints>
260
      <Constraints>
337
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
261
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
Lines 341-345 Link Here
341
265
342
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
266
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
343
    </Container>
267
    </Container>
268
    <Container class="javax.swing.JPanel" name="typeChooserPanelContainer">
269
      <Constraints>
270
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
271
          <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
272
        </Constraint>
273
      </Constraints>
274
275
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
276
    </Container>
344
  </SubComponents>
277
  </SubComponents>
345
</Form>
278
</Form>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/BasicInfoVisualPanel.java (-395 / +139 lines)
Lines 43-59 Link Here
43
43
44
import java.awt.event.ActionEvent;
44
import java.awt.event.ActionEvent;
45
import java.awt.event.ActionListener;
45
import java.awt.event.ActionListener;
46
import java.beans.PropertyChangeEvent;
47
import java.beans.PropertyChangeListener;
46
import java.io.File;
48
import java.io.File;
47
import java.io.IOException;
48
import java.text.MessageFormat;
49
import java.text.MessageFormat;
49
import javax.swing.ButtonModel;
50
import javax.swing.JComboBox;
50
import javax.swing.JComboBox;
51
import javax.swing.JFileChooser;
51
import javax.swing.JFileChooser;
52
import javax.swing.event.DocumentEvent;
52
import javax.swing.event.DocumentEvent;
53
import javax.swing.event.DocumentListener;
53
import javax.swing.event.DocumentListener;
54
import org.netbeans.api.project.Project;
55
import org.netbeans.api.project.ProjectManager;
56
import org.netbeans.api.project.ProjectUtils;
57
import org.netbeans.modules.apisupport.project.ui.ModuleUISettings;
54
import org.netbeans.modules.apisupport.project.ui.ModuleUISettings;
58
import org.netbeans.modules.apisupport.project.universe.ModuleList;
55
import org.netbeans.modules.apisupport.project.universe.ModuleList;
59
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
56
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
Lines 61-70 Link Here
61
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
58
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
62
import org.netbeans.modules.apisupport.project.ui.platform.PlatformComponentFactory;
59
import org.netbeans.modules.apisupport.project.ui.platform.PlatformComponentFactory;
63
import org.netbeans.modules.apisupport.project.ui.platform.NbPlatformCustomizer;
60
import org.netbeans.modules.apisupport.project.ui.platform.NbPlatformCustomizer;
61
import org.netbeans.modules.apisupport.project.ui.wizard.spi.ModuleTypePanel;
64
import org.netbeans.spi.project.ui.support.ProjectChooser;
62
import org.netbeans.spi.project.ui.support.ProjectChooser;
65
import org.openide.DialogDescriptor;
63
import org.openide.WizardDescriptor;
66
import org.openide.DialogDisplayer;
67
import org.openide.ErrorManager;
68
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
69
import org.openide.util.NbBundle;
65
import org.openide.util.NbBundle;
70
66
Lines 83-122 Link Here
83
 *
79
 *
84
 * @author Martin Krauskopf
80
 * @author Martin Krauskopf
85
 */
81
 */
86
public class BasicInfoVisualPanel extends BasicVisualPanel.NewTemplatePanel {
82
public class BasicInfoVisualPanel extends BasicVisualPanel.NewTemplatePanel
83
        implements PropertyChangeListener
84
{
87
    
85
    
88
    private ButtonModel lastSelectedType;
89
    private static String lastSelectedSuite;
90
    private boolean locationUpdated;
86
    private boolean locationUpdated;
91
    private boolean nameUpdated;
87
    private boolean nameUpdated;
92
    private boolean moduleTypeGroupAttached = true;
93
    private boolean mainProjectTouched;
88
    private boolean mainProjectTouched;
94
    
89
    
95
    /** Creates new form BasicInfoVisualPanel */
90
    /** Creates new form BasicInfoVisualPanel */
96
    BasicInfoVisualPanel(final NewModuleProjectData data) {
91
    BasicInfoVisualPanel(final NewModuleProjectData data) {
97
        super(data);
92
        super(data);
98
        initComponents();
93
        initComponents();
99
        initAccessibility();
94
        initPlatformCombo(suitePlatformValue);
100
        initPlatformCombos();
95
        initPanels();
101
        setComponentsVisibility();
96
        setComponentsVisibility();
102
        switch (data.getWizardType()) {
97
        switch (data.getWizardType()) {
103
            case SUITE:
98
            case SUITE:
104
            case APPLICATION:
99
            case APPLICATION:
105
                detachModuleTypeGroup();
100
            case LIBRARY_MODULE:
106
                break;
101
                break;
107
            case MODULE:
102
            case MODULE:
108
            case SUITE_COMPONENT:
103
            case SUITE_COMPONENT:
109
                if (moduleSuiteValue.getItemCount() > 0) {
104
                if (TypeChooserPanelImpl.getDefaultSuitesComboBox().getItemCount() > 0) {
110
                    restoreSelectedSuite();
111
                    suiteComponent.setSelected(true);
112
                    mainProject.setSelected(false);
105
                    mainProject.setSelected(false);
113
                }
114
                break;
115
            case LIBRARY_MODULE:
116
                moduleSuite.setText(getMessage("LBL_Add_to_Suite")); // NOI18N
117
                suiteComponent.setSelected(true);
118
                if (moduleSuiteValue.getItemCount() > 0) {
119
                    restoreSelectedSuite();
120
                }
106
                }
121
                break;
107
                break;
122
            default:
108
            default:
Lines 125-136 Link Here
125
        attachDocumentListeners();
111
        attachDocumentListeners();
126
        setInitialLocation();
112
        setInitialLocation();
127
        setInitialProjectName();
113
        setInitialProjectName();
128
        updateEnabled();
114
    }
115
    
116
    protected static boolean isNetBeansOrgFolder(File folder) {
117
        return ModuleList.findNetBeansOrg(folder) != null;
118
    }
119
    
120
    protected static void initPlatformCombo(JComboBox combo) {
121
        if (combo == null){
122
            return;
123
        }
124
        if (combo.getItemCount() <= 0) {
125
            return;
126
        }
127
        boolean set = false;
128
        String idToSelect = ModuleUISettings.getDefault().getLastUsedPlatformID();
129
        for (int i = 0; i < combo.getItemCount(); i++) {
130
            if (((NbPlatform) combo.getItemAt(i)).getID().equals(idToSelect)) {
131
                combo.setSelectedIndex(i);
132
                set = true;
133
                break;
134
            }
135
        }
136
        if (!set) {
137
            NbPlatform defPlaf = NbPlatform.getDefaultPlatform();
138
            combo.setSelectedItem(defPlaf == null ? combo.getItemAt(0) : defPlaf);
139
        }
140
    }
141
142
    public void propertyChange(PropertyChangeEvent evt) {
143
        if (ModuleTypePanel.isPanelUpdated(evt)){
144
            moduleTypePanelUpdated();
145
        }
146
    }
147
    
148
    private void moduleTypePanelUpdated() {
149
        boolean isStandAlone = ModuleTypePanel.isStandalone(getSettings());
150
        boolean isSuiteComponent = ModuleTypePanel.isSuiteComponent(getSettings());
151
        // both radio buttons are deselected and disaled
152
        if (!isStandAlone && !isSuiteComponent){
153
            return;
154
        }
155
        
156
        if (!mainProjectTouched) {
157
            mainProject.setSelected(isStandAlone);
158
        }
159
        if (!locationUpdated) {
160
            setInitialLocation();
161
        }
162
        if (!nameUpdated) {
163
            setInitialProjectName();
164
        }
165
        updateAndCheck();
129
    }
166
    }
130
    
167
    
131
    private void setInitialLocation() {
168
    private void setInitialLocation() {
132
        if (isSuiteComponent()) {
169
        if (ModuleTypePanel.isSuiteComponent(getSettings())) {
133
            computeAndSetLocation((String) moduleSuiteValue.getSelectedItem(), true);
170
            computeAndSetLocation(ModuleTypePanel.getSuiteRoot(getSettings()), true);
134
        } else { // suite or standalone module
171
        } else { // suite or standalone module
135
            String location = computeLocationValue(ProjectChooser.getProjectsFolder().getAbsolutePath());
172
            String location = computeLocationValue(ProjectChooser.getProjectsFolder().getAbsolutePath());
136
            File locationF = new File(location);
173
            File locationF = new File(location);
Lines 142-164 Link Here
142
        }
179
        }
143
    }
180
    }
144
    
181
    
145
    private void initAccessibility() {
182
    private void initPanels(){
146
        this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_BasicInfoVisualPanel"));
183
        if (typeChooserPanel != null){
147
        browseButton.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_BrowseButton"));
184
            typeChooserPanelContainer.removeAll();
148
        browseSuiteButton.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_BrowseSuiteButton"));
185
            typeChooserPanel = null;
149
        folderValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_FolderValue"));
186
        }
150
        locationValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_LocationValue"));
187
        typeChooserPanel = new TypeChooserPanelImpl(getSettings(), getData().getWizardType());
151
        mainProject.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_MainProject"));
188
        typeChooserPanelContainer.add(typeChooserPanel);
152
        managePlatform.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ManagePlatform"));
189
        typeChooserPanelContainer.validate();
153
        manageSuitePlatform.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ManageSuitePlatform"));
154
        moduleSuiteValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ModuleSuiteValue"));
155
        nameValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_NameValue"));
156
        platformValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_PlatformValue"));
157
        standAloneModule.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_StandAloneModule"));
158
        suiteComponent.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_SuiteModule"));
159
        suitePlatformValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_SuitePlatformValue"));
160
    }
190
    }
161
    
191
162
    private void setComponentsVisibility() {
192
    private void setComponentsVisibility() {
163
        boolean isSuiteWizard = isSuiteWizard();
193
        boolean isSuiteWizard = isSuiteWizard();
164
        boolean isSuiteComponentWizard = isSuiteComponentWizard();
194
        boolean isSuiteComponentWizard = isSuiteComponentWizard();
Lines 170-213 Link Here
170
        manageSuitePlatform.setVisible(isSuiteWizard);
200
        manageSuitePlatform.setVisible(isSuiteWizard);
171
        mainProject.setVisible(!isLibraryWizard);
201
        mainProject.setVisible(!isLibraryWizard);
172
        
202
        
173
        suiteComponent.setVisible(!isLibraryWizard);
174
        platform.setVisible(!isLibraryWizard);
175
        platformValue.setVisible(!isLibraryWizard);
176
        managePlatform.setVisible(!isLibraryWizard);
177
        standAloneModule.setVisible(!isLibraryWizard);
178
        mainProject.setSelected(!isLibraryWizard);
203
        mainProject.setSelected(!isLibraryWizard);
179
        
204
        
180
        standAloneModule.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
205
        if (typeChooserPanel != null){
181
        platform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
206
            typeChooserPanel.setComponentsVisibility(isSuiteComponentWizard, isLibraryWizard);
182
        platformValue.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
183
        managePlatform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
184
        suiteComponent.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
185
    }
186
    
187
    private void restoreSelectedSuite() {
188
        String preferredSuiteDir  = getPreferredSuiteDir();
189
        if (preferredSuiteDir != null) {
190
            lastSelectedSuite = preferredSuiteDir;
191
        }
207
        }
192
        if (lastSelectedSuite != null) {
193
            int max = moduleSuiteValue.getModel().getSize();
194
            for (int i=0; i < max; i++) {
195
                if (lastSelectedSuite.equals(moduleSuiteValue.getModel().getElementAt(i))) {
196
                    moduleSuiteValue.setSelectedItem(lastSelectedSuite);
197
                    break;
198
                }
199
            }
200
        }
201
    }
202
    
203
    private String getPreferredSuiteDir() {
204
        return (String) getSettings().getProperty(NewNbModuleWizardIterator.PREFERRED_SUITE_DIR);
205
    }
206
    
207
    private boolean isOneSuiteDedicatedMode() {
208
        Boolean b = (Boolean) getSettings().getProperty(
209
                NewNbModuleWizardIterator.ONE_SUITE_DEDICATED_MODE);
210
        return b != null ? b.booleanValue() : false;
211
    }
208
    }
212
    
209
    
213
    private String getNameValue() {
210
    private String getNameValue() {
Lines 222-265 Link Here
222
        return new File(getLocationValue());
219
        return new File(getLocationValue());
223
    }
220
    }
224
    
221
    
225
    private void updateEnabled() {
226
        boolean isNetBeansOrg = isNetBeansOrgFolder();
227
        standAloneModule.setEnabled(!isNetBeansOrg);
228
        suiteComponent.setEnabled(!isNetBeansOrg);
229
        
230
        boolean standalone = isStandAlone();
231
        boolean suiteModuleSelected = isSuiteComponent();
232
        platform.setEnabled(standalone);
233
        platformValue.setEnabled(standalone);
234
        managePlatform.setEnabled(standalone);
235
        moduleSuite.setEnabled(suiteModuleSelected);
236
        moduleSuiteValue.setEnabled(suiteModuleSelected && !isOneSuiteDedicatedMode());
237
        browseSuiteButton.setEnabled(suiteModuleSelected && !isOneSuiteDedicatedMode());
238
    }
239
    
240
    void updateAndCheck() {
222
    void updateAndCheck() {
241
        updateGUI();
223
        updateGUI();
242
        
224
        
243
        if ("".equals(getNameValue())) {
225
        if ("".equals(getNameValue())) {
244
            setError(getMessage("MSG_NameCannotBeEmpty"));
226
            setError(NbBundle.getMessage(
227
                    BasicInfoVisualPanel.class, "MSG_NameCannotBeEmpty"));//NOI18N
245
        } else if ("".equals(getLocationValue())) {
228
        } else if ("".equals(getLocationValue())) {
246
            setError(getMessage("MSG_LocationCannotBeEmpty"));
229
            setError(NbBundle.getMessage(
230
                    BasicInfoVisualPanel.class, "MSG_LocationCannotBeEmpty"));//NOI18N
247
        } else if (isLibraryWizard() && isNetBeansOrgFolder()) {
231
        } else if (isLibraryWizard() && isNetBeansOrgFolder()) {
248
            setError(getMessage("MSG_LibraryWrapperForNBOrgUnsupported"));
232
            setError(NbBundle.getMessage(
249
        } else if (isSuiteComponent() && moduleSuiteValue.getSelectedItem() == null) {
233
                    BasicInfoVisualPanel.class, "MSG_LibraryWrapperForNBOrgUnsupported"));//NOI18N
250
            setError(getMessage("MSG_ChooseRegularSuite"));
234
        } else if (!ModuleTypePanel.validate(getSettings())) {
251
        } else if (isStandAlone() &&
235
            setError((String)getSettings().getProperty(WizardDescriptor.PROP_ERROR_MESSAGE));
252
                (platformValue.getSelectedItem() == null || !((NbPlatform) platformValue.getSelectedItem()).isValid())) {
253
            setError(getMessage("MSG_ChosenPlatformIsInvalid"));
254
        } else if (isSuiteWizard() &&
236
        } else if (isSuiteWizard() &&
255
                (suitePlatformValue.getSelectedItem() == null || !((NbPlatform) suitePlatformValue.getSelectedItem()).isValid())) {
237
                (suitePlatformValue.getSelectedItem() == null || !((NbPlatform) suitePlatformValue.getSelectedItem()).isValid())) 
256
            setError(getMessage("MSG_ChosenPlatformIsInvalid"));
238
        {
239
            setError(NbBundle.getMessage(
240
                    BasicInfoVisualPanel.class, "MSG_ChosenPlatformIsInvalid"));//NOI18N
257
        } else if (getFolder().exists()) {
241
        } else if (getFolder().exists()) {
258
            setError(getMessage("MSG_ProjectFolderExists"));
242
            setError(NbBundle.getMessage(
243
                    BasicInfoVisualPanel.class, "MSG_ProjectFolderExists"));//NOI18N
259
        } else if (!getLocationFile().exists()) {
244
        } else if (!getLocationFile().exists()) {
260
            setError(getMessage("MSG_LocationMustExist"));
245
            setError(NbBundle.getMessage(
246
                    BasicInfoVisualPanel.class, "MSG_LocationMustExist"));//NOI18N
261
        } else if (!getLocationFile().canWrite()) {
247
        } else if (!getLocationFile().canWrite()) {
262
            setError(getMessage("MSG_LocationNotWritable"));
248
            setError(NbBundle.getMessage(
249
                    BasicInfoVisualPanel.class, "MSG_LocationNotWritable"));//NOI18N
263
        } else {
250
        } else {
264
            markValid();
251
            markValid();
265
        }
252
        }
Lines 268-304 Link Here
268
    private void updateGUI() {
255
    private void updateGUI() {
269
        // update project folder
256
        // update project folder
270
        folderValue.setText(getFolder().getPath());
257
        folderValue.setText(getFolder().getPath());
271
        
258
272
        if (isSuiteWizard() || isNetBeansOrgFolder()) {
259
        ModuleTypePanel.setProjectFolder(getSettings(), getFolder());
273
            detachModuleTypeGroup();
274
        } else {
275
            attachModuleTypeGroup();
276
        }
277
        updateEnabled();
278
    }
279
    
280
    private void detachModuleTypeGroup() {
281
        if (moduleTypeGroupAttached) {
282
            lastSelectedType = moduleTypeGroup.getSelection();
283
            moduleTypeGroup.remove(standAloneModule);
284
            moduleTypeGroup.remove(suiteComponent);
285
            standAloneModule.setSelected(false);
286
            suiteComponent.setSelected(false);
287
            moduleTypeGroupAttached = false;
288
        }
289
    }
290
    
291
    private void attachModuleTypeGroup() {
292
        if (!moduleTypeGroupAttached) {
293
            moduleTypeGroup.add(standAloneModule);
294
            moduleTypeGroup.add(suiteComponent);
295
            if (isLibraryWizard()) {
296
                suiteComponent.setSelected(true);
297
            } else {
298
                moduleTypeGroup.setSelected(lastSelectedType, true);
299
            }
300
            moduleTypeGroupAttached = true;
301
        }
302
    }
260
    }
303
    
261
    
304
    /** Set <em>next</em> free project name. */
262
    /** Set <em>next</em> free project name. */
Lines 324-335 Link Here
324
        getData().setProjectFolder(folderValue.getText());
282
        getData().setProjectFolder(folderValue.getText());
325
        getData().setMainProject(mainProject.isSelected());
283
        getData().setMainProject(mainProject.isSelected());
326
        getData().setNetBeansOrg(isNetBeansOrgFolder());
284
        getData().setNetBeansOrg(isNetBeansOrgFolder());
327
        getData().setStandalone(isStandAlone());
285
        getData().setStandalone(ModuleTypePanel.isStandalone(getSettings()));
328
        getData().setSuiteRoot((String) moduleSuiteValue.getSelectedItem());
286
        getData().setSuiteRoot(ModuleTypePanel.getSuiteRoot(getSettings()));
329
        if (isSuiteWizard() && suitePlatformValue.getSelectedItem() != null) {
287
        if (isSuiteWizard() && suitePlatformValue.getSelectedItem() != null) {
330
            getData().setPlatformID(((NbPlatform) suitePlatformValue.getSelectedItem()).getID());
288
            getData().setPlatformID(((NbPlatform) suitePlatformValue.getSelectedItem()).getID());
331
        } else if (platformValue.getSelectedItem() != null) {
289
        } else if (ModuleTypePanel.getActivePlatformId(getSettings()) != null) {
332
            getData().setPlatformID(((NbPlatform) platformValue.getSelectedItem()).getID());
290
            getData().setPlatformID(ModuleTypePanel.getActivePlatformId(getSettings()));
333
        }
291
        }
334
    }
292
    }
335
    
293
    
Lines 365-371 Link Here
365
            default:
323
            default:
366
                assert false : "Unknown wizard type = " + getData().getWizardType();
324
                assert false : "Unknown wizard type = " + getData().getWizardType();
367
        }
325
        }
368
        setProjectName(getMessage(bundlekey), counter);
326
        setProjectName(NbBundle.getMessage(BasicInfoVisualPanel.class, bundlekey), counter);
369
        nameValue.select(0, nameValue.getText().length());
327
        nameValue.select(0, nameValue.getText().length());
370
        nameUpdated = false;
328
        nameUpdated = false;
371
    }
329
    }
Lines 387-394 Link Here
387
                updateAndCheck();
345
                updateAndCheck();
388
            }
346
            }
389
        };
347
        };
390
        platformValue.addActionListener(plafAL);
391
        suitePlatformValue.addActionListener(plafAL);
348
        suitePlatformValue.addActionListener(plafAL);
349
        getSettings().addPropertyChangeListener(this);
392
    }
350
    }
393
    
351
    
394
    private File getFolder() {
352
    private File getFolder() {
Lines 401-432 Link Here
401
    }
359
    }
402
    
360
    
403
    private boolean isNetBeansOrgFolder() {
361
    private boolean isNetBeansOrgFolder() {
404
        return ModuleList.findNetBeansOrg(getFolder()) != null;
362
        return isNetBeansOrgFolder(getFolder());
405
    }
406
    
407
    private static String getMessage(String key) {
408
        return NbBundle.getMessage(BasicInfoVisualPanel.class, key);
409
    }
410
    
411
    private void initPlatformCombos() {
412
        if (platformValue.getItemCount() <= 0) {
413
            return;
414
        }
415
        boolean set = false;
416
        String idToSelect = ModuleUISettings.getDefault().getLastUsedPlatformID();
417
        for (int i = 0; i < platformValue.getItemCount(); i++) {
418
            if (((NbPlatform) platformValue.getItemAt(i)).getID().equals(idToSelect)) {
419
                platformValue.setSelectedIndex(i);
420
                suitePlatformValue.setSelectedIndex(i);
421
                set = true;
422
                break;
423
            }
424
        }
425
        if (!set) {
426
            NbPlatform defPlaf = NbPlatform.getDefaultPlatform();
427
            platformValue.setSelectedItem(defPlaf == null ? platformValue.getItemAt(0) : defPlaf);
428
            suitePlatformValue.setSelectedItem(defPlaf == null ? suitePlatformValue.getItemAt(0) : defPlaf);
429
        }
430
    }
363
    }
431
    
364
    
432
    private void setLocation(String location, boolean silently) {
365
    private void setLocation(String location, boolean silently) {
Lines 451-470 Link Here
451
        }
384
        }
452
    }
385
    }
453
    
386
    
454
    private boolean isStandAlone() {
455
        return standAloneModule.isSelected();
456
    }
457
    
458
    private boolean isSuiteComponent() {
459
        return suiteComponent.isSelected();
460
    }
461
    
462
    /** This method is called from within the constructor to
387
    /** This method is called from within the constructor to
463
     * initialize the form.
388
     * initialize the form.
464
     * WARNING: Do NOT modify this code. The content of this method is
389
     * WARNING: Do NOT modify this code. The content of this method is
465
     * always regenerated by the Form Editor.
390
     * always regenerated by the Form Editor.
466
     */
391
     */
467
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
392
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
468
    private void initComponents() {
393
    private void initComponents() {
469
        java.awt.GridBagConstraints gridBagConstraints;
394
        java.awt.GridBagConstraints gridBagConstraints;
470
395
Lines 483-506 Link Here
483
        manageSuitePlatform = new javax.swing.JButton();
408
        manageSuitePlatform = new javax.swing.JButton();
484
        separator3 = new javax.swing.JSeparator();
409
        separator3 = new javax.swing.JSeparator();
485
        mainProject = new javax.swing.JCheckBox();
410
        mainProject = new javax.swing.JCheckBox();
486
        typeChooserPanel = new javax.swing.JPanel();
487
        standAloneModule = new javax.swing.JRadioButton();
488
        platform = new javax.swing.JLabel();
489
        platformValue = PlatformComponentFactory.getNbPlatformsComboxBox();
490
        managePlatform = new javax.swing.JButton();
491
        suiteComponent = new javax.swing.JRadioButton();
492
        moduleSuite = new javax.swing.JLabel();
493
        moduleSuiteValue = PlatformComponentFactory.getSuitesComboBox();
494
        browseSuiteButton = new javax.swing.JButton();
495
        chooserFiller = new javax.swing.JLabel();
496
        pnlThouShaltBeholdLayout = new javax.swing.JPanel();
411
        pnlThouShaltBeholdLayout = new javax.swing.JPanel();
412
        typeChooserPanelContainer = new javax.swing.JPanel();
497
413
498
        setLayout(new java.awt.GridBagLayout());
414
        setLayout(new java.awt.GridBagLayout());
499
415
500
        infoPanel.setLayout(new java.awt.GridBagLayout());
416
        infoPanel.setLayout(new java.awt.GridBagLayout());
501
417
502
        nameLbl.setLabelFor(nameValue);
418
        nameLbl.setLabelFor(nameValue);
503
        org.openide.awt.Mnemonics.setLocalizedText(nameLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectName"));
419
        org.openide.awt.Mnemonics.setLocalizedText(nameLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectName")); // NOI18N
504
        gridBagConstraints = new java.awt.GridBagConstraints();
420
        gridBagConstraints = new java.awt.GridBagConstraints();
505
        gridBagConstraints.gridx = 0;
421
        gridBagConstraints.gridx = 0;
506
        gridBagConstraints.gridy = 0;
422
        gridBagConstraints.gridy = 0;
Lines 509-515 Link Here
509
        infoPanel.add(nameLbl, gridBagConstraints);
425
        infoPanel.add(nameLbl, gridBagConstraints);
510
426
511
        locationLbl.setLabelFor(locationValue);
427
        locationLbl.setLabelFor(locationValue);
512
        org.openide.awt.Mnemonics.setLocalizedText(locationLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectLocation"));
428
        org.openide.awt.Mnemonics.setLocalizedText(locationLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectLocation")); // NOI18N
513
        gridBagConstraints = new java.awt.GridBagConstraints();
429
        gridBagConstraints = new java.awt.GridBagConstraints();
514
        gridBagConstraints.gridx = 0;
430
        gridBagConstraints.gridx = 0;
515
        gridBagConstraints.gridy = 1;
431
        gridBagConstraints.gridy = 1;
Lines 518-524 Link Here
518
        infoPanel.add(locationLbl, gridBagConstraints);
434
        infoPanel.add(locationLbl, gridBagConstraints);
519
435
520
        folderLbl.setLabelFor(folderValue);
436
        folderLbl.setLabelFor(folderValue);
521
        org.openide.awt.Mnemonics.setLocalizedText(folderLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectFolder"));
437
        org.openide.awt.Mnemonics.setLocalizedText(folderLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectFolder")); // NOI18N
522
        gridBagConstraints = new java.awt.GridBagConstraints();
438
        gridBagConstraints = new java.awt.GridBagConstraints();
523
        gridBagConstraints.gridx = 0;
439
        gridBagConstraints.gridx = 0;
524
        gridBagConstraints.gridy = 2;
440
        gridBagConstraints.gridy = 2;
Lines 534-539 Link Here
534
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
450
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
535
        gridBagConstraints.weightx = 1.0;
451
        gridBagConstraints.weightx = 1.0;
536
        infoPanel.add(nameValue, gridBagConstraints);
452
        infoPanel.add(nameValue, gridBagConstraints);
453
        nameValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_NameValue")); // NOI18N
454
        nameValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_NameValue")); // NOI18N
537
455
538
        locationValue.setHorizontalAlignment(javax.swing.JTextField.LEFT);
456
        locationValue.setHorizontalAlignment(javax.swing.JTextField.LEFT);
539
        gridBagConstraints = new java.awt.GridBagConstraints();
457
        gridBagConstraints = new java.awt.GridBagConstraints();
Lines 543-561 Link Here
543
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
461
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
544
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
462
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
545
        infoPanel.add(locationValue, gridBagConstraints);
463
        infoPanel.add(locationValue, gridBagConstraints);
464
        locationValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_LocationValue")); // NOI18N
465
        locationValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_LocationValue")); // NOI18N
546
466
547
        org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_BrowseButton_o"));
467
        org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_BrowseButton_o")); // NOI18N
548
        browseButton.addActionListener(new java.awt.event.ActionListener() {
468
        browseButton.addActionListener(new java.awt.event.ActionListener() {
549
            public void actionPerformed(java.awt.event.ActionEvent evt) {
469
            public void actionPerformed(java.awt.event.ActionEvent evt) {
550
                browseLocation(evt);
470
                browseLocation(evt);
551
            }
471
            }
552
        });
472
        });
553
554
        gridBagConstraints = new java.awt.GridBagConstraints();
473
        gridBagConstraints = new java.awt.GridBagConstraints();
555
        gridBagConstraints.gridx = 2;
474
        gridBagConstraints.gridx = 2;
556
        gridBagConstraints.gridy = 1;
475
        gridBagConstraints.gridy = 1;
557
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
476
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
558
        infoPanel.add(browseButton, gridBagConstraints);
477
        infoPanel.add(browseButton, gridBagConstraints);
478
        browseButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_BrowseButton")); // NOI18N
479
        browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_BrowseButton")); // NOI18N
559
480
560
        gridBagConstraints = new java.awt.GridBagConstraints();
481
        gridBagConstraints = new java.awt.GridBagConstraints();
561
        gridBagConstraints.gridx = 1;
482
        gridBagConstraints.gridx = 1;
Lines 570-585 Link Here
570
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
491
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
571
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
492
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
572
        infoPanel.add(folderValue, gridBagConstraints);
493
        infoPanel.add(folderValue, gridBagConstraints);
494
        folderValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_FolderValue")); // NOI18N
495
        folderValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_FolderValue")); // NOI18N
573
496
574
        suitePlatform.setLabelFor(suitePlatformValue);
497
        suitePlatform.setLabelFor(suitePlatformValue);
575
        org.openide.awt.Mnemonics.setLocalizedText(suitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_NetBeansPlatform"));
498
        org.openide.awt.Mnemonics.setLocalizedText(suitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_NetBeansPlatform")); // NOI18N
576
        gridBagConstraints = new java.awt.GridBagConstraints();
499
        gridBagConstraints = new java.awt.GridBagConstraints();
577
        gridBagConstraints.gridx = 0;
500
        gridBagConstraints.gridx = 0;
578
        gridBagConstraints.gridy = 4;
501
        gridBagConstraints.gridy = 4;
579
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
502
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
580
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 12);
503
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 12);
581
        infoPanel.add(suitePlatform, gridBagConstraints);
504
        infoPanel.add(suitePlatform, gridBagConstraints);
582
583
        gridBagConstraints = new java.awt.GridBagConstraints();
505
        gridBagConstraints = new java.awt.GridBagConstraints();
584
        gridBagConstraints.gridx = 1;
506
        gridBagConstraints.gridx = 1;
585
        gridBagConstraints.gridy = 4;
507
        gridBagConstraints.gridy = 4;
Lines 588-601 Link Here
588
        gridBagConstraints.weightx = 1.0;
510
        gridBagConstraints.weightx = 1.0;
589
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
511
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
590
        infoPanel.add(suitePlatformValue, gridBagConstraints);
512
        infoPanel.add(suitePlatformValue, gridBagConstraints);
513
        suitePlatformValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_SuitePlatformValue")); // NOI18N
514
        suitePlatformValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_SuitePlatformValue")); // NOI18N
591
515
592
        org.openide.awt.Mnemonics.setLocalizedText(manageSuitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_ManagePlatforms_g"));
516
        org.openide.awt.Mnemonics.setLocalizedText(manageSuitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_ManagePlatforms_g")); // NOI18N
593
        manageSuitePlatform.addActionListener(new java.awt.event.ActionListener() {
517
        manageSuitePlatform.addActionListener(new java.awt.event.ActionListener() {
594
            public void actionPerformed(java.awt.event.ActionEvent evt) {
518
            public void actionPerformed(java.awt.event.ActionEvent evt) {
595
                manageSuitePlatformActionPerformed(evt);
519
                manageSuitePlatformActionPerformed(evt);
596
            }
520
            }
597
        });
521
        });
598
599
        gridBagConstraints = new java.awt.GridBagConstraints();
522
        gridBagConstraints = new java.awt.GridBagConstraints();
600
        gridBagConstraints.gridx = 2;
523
        gridBagConstraints.gridx = 2;
601
        gridBagConstraints.gridy = 4;
524
        gridBagConstraints.gridy = 4;
Lines 603-608 Link Here
603
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
526
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
604
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
527
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
605
        infoPanel.add(manageSuitePlatform, gridBagConstraints);
528
        infoPanel.add(manageSuitePlatform, gridBagConstraints);
529
        manageSuitePlatform.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_ManageSuitePlatform")); // NOI18N
530
        manageSuitePlatform.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_ManageSuitePlatform")); // NOI18N
606
531
607
        gridBagConstraints = new java.awt.GridBagConstraints();
532
        gridBagConstraints = new java.awt.GridBagConstraints();
608
        gridBagConstraints.gridx = 0;
533
        gridBagConstraints.gridx = 0;
Lines 621-763 Link Here
621
        add(infoPanel, gridBagConstraints);
546
        add(infoPanel, gridBagConstraints);
622
547
623
        mainProject.setSelected(true);
548
        mainProject.setSelected(true);
624
        org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_SetAsMainProject"));
549
        org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_SetAsMainProject")); // NOI18N
625
        mainProject.addActionListener(new java.awt.event.ActionListener() {
550
        mainProject.addActionListener(new java.awt.event.ActionListener() {
626
            public void actionPerformed(java.awt.event.ActionEvent evt) {
551
            public void actionPerformed(java.awt.event.ActionEvent evt) {
627
                mainProjectActionPerformed(evt);
552
                mainProjectActionPerformed(evt);
628
            }
553
            }
629
        });
554
        });
630
631
        gridBagConstraints = new java.awt.GridBagConstraints();
555
        gridBagConstraints = new java.awt.GridBagConstraints();
632
        gridBagConstraints.gridx = 0;
556
        gridBagConstraints.gridx = 0;
633
        gridBagConstraints.gridy = 2;
557
        gridBagConstraints.gridy = 2;
634
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
558
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
635
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
559
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
636
        add(mainProject, gridBagConstraints);
560
        add(mainProject, gridBagConstraints);
637
561
        mainProject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_MainProject")); // NOI18N
638
        typeChooserPanel.setLayout(new java.awt.GridBagLayout());
562
        mainProject.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_MainProject")); // NOI18N
639
640
        moduleTypeGroup.add(standAloneModule);
641
        standAloneModule.setSelected(true);
642
        org.openide.awt.Mnemonics.setLocalizedText(standAloneModule, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_StandaloneModule"));
643
        standAloneModule.addActionListener(new java.awt.event.ActionListener() {
644
            public void actionPerformed(java.awt.event.ActionEvent evt) {
645
                typeChanged(evt);
646
            }
647
        });
648
649
        gridBagConstraints = new java.awt.GridBagConstraints();
650
        gridBagConstraints.gridx = 0;
651
        gridBagConstraints.gridy = 0;
652
        gridBagConstraints.gridwidth = 3;
653
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
654
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
655
        typeChooserPanel.add(standAloneModule, gridBagConstraints);
656
657
        platform.setLabelFor(platformValue);
658
        org.openide.awt.Mnemonics.setLocalizedText(platform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_NetBeansPlatform"));
659
        gridBagConstraints = new java.awt.GridBagConstraints();
660
        gridBagConstraints.gridx = 0;
661
        gridBagConstraints.gridy = 1;
662
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
663
        gridBagConstraints.insets = new java.awt.Insets(0, 18, 0, 12);
664
        typeChooserPanel.add(platform, gridBagConstraints);
665
666
        platformValue.addActionListener(new java.awt.event.ActionListener() {
667
            public void actionPerformed(java.awt.event.ActionEvent evt) {
668
                platformChosen(evt);
669
            }
670
        });
671
672
        gridBagConstraints = new java.awt.GridBagConstraints();
673
        gridBagConstraints.gridx = 1;
674
        gridBagConstraints.gridy = 1;
675
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
676
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
677
        gridBagConstraints.weightx = 1.0;
678
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
679
        typeChooserPanel.add(platformValue, gridBagConstraints);
680
681
        org.openide.awt.Mnemonics.setLocalizedText(managePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_ManagePlatforms_g"));
682
        managePlatform.addActionListener(new java.awt.event.ActionListener() {
683
            public void actionPerformed(java.awt.event.ActionEvent evt) {
684
                managePlatformActionPerformed(evt);
685
            }
686
        });
687
688
        gridBagConstraints = new java.awt.GridBagConstraints();
689
        gridBagConstraints.gridx = 2;
690
        gridBagConstraints.gridy = 1;
691
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
692
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
693
        typeChooserPanel.add(managePlatform, gridBagConstraints);
694
695
        moduleTypeGroup.add(suiteComponent);
696
        org.openide.awt.Mnemonics.setLocalizedText(suiteComponent, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_AddToModuleSuite"));
697
        suiteComponent.addActionListener(new java.awt.event.ActionListener() {
698
            public void actionPerformed(java.awt.event.ActionEvent evt) {
699
                typeChanged(evt);
700
            }
701
        });
702
703
        gridBagConstraints = new java.awt.GridBagConstraints();
704
        gridBagConstraints.gridx = 0;
705
        gridBagConstraints.gridy = 2;
706
        gridBagConstraints.gridwidth = 3;
707
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
708
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 0, 0);
709
        typeChooserPanel.add(suiteComponent, gridBagConstraints);
710
711
        moduleSuite.setLabelFor(moduleSuiteValue);
712
        org.openide.awt.Mnemonics.setLocalizedText(moduleSuite, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ModuleSuite"));
713
        gridBagConstraints = new java.awt.GridBagConstraints();
714
        gridBagConstraints.gridx = 0;
715
        gridBagConstraints.gridy = 3;
716
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
717
        gridBagConstraints.insets = new java.awt.Insets(6, 18, 0, 12);
718
        typeChooserPanel.add(moduleSuite, gridBagConstraints);
719
720
        moduleSuiteValue.addActionListener(new java.awt.event.ActionListener() {
721
            public void actionPerformed(java.awt.event.ActionEvent evt) {
722
                moduleSuiteChosen(evt);
723
            }
724
        });
725
726
        gridBagConstraints = new java.awt.GridBagConstraints();
727
        gridBagConstraints.gridx = 1;
728
        gridBagConstraints.gridy = 3;
729
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
730
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
731
        gridBagConstraints.weightx = 1.0;
732
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 12);
733
        typeChooserPanel.add(moduleSuiteValue, gridBagConstraints);
734
735
        org.openide.awt.Mnemonics.setLocalizedText(browseSuiteButton, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_BrowseButton_w"));
736
        browseSuiteButton.addActionListener(new java.awt.event.ActionListener() {
737
            public void actionPerformed(java.awt.event.ActionEvent evt) {
738
                browseModuleSuite(evt);
739
            }
740
        });
741
742
        gridBagConstraints = new java.awt.GridBagConstraints();
743
        gridBagConstraints.gridx = 2;
744
        gridBagConstraints.gridy = 3;
745
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
746
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
747
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
748
        typeChooserPanel.add(browseSuiteButton, gridBagConstraints);
749
750
        gridBagConstraints = new java.awt.GridBagConstraints();
751
        gridBagConstraints.gridx = 0;
752
        gridBagConstraints.gridy = 4;
753
        gridBagConstraints.weighty = 1.0;
754
        typeChooserPanel.add(chooserFiller, gridBagConstraints);
755
756
        gridBagConstraints = new java.awt.GridBagConstraints();
757
        gridBagConstraints.gridx = 0;
758
        gridBagConstraints.gridy = 1;
759
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
760
        add(typeChooserPanel, gridBagConstraints);
761
563
762
        gridBagConstraints = new java.awt.GridBagConstraints();
564
        gridBagConstraints = new java.awt.GridBagConstraints();
763
        gridBagConstraints.gridx = 0;
565
        gridBagConstraints.gridx = 0;
Lines 768-773 Link Here
768
        gridBagConstraints.weighty = 1.0;
570
        gridBagConstraints.weighty = 1.0;
769
        add(pnlThouShaltBeholdLayout, gridBagConstraints);
571
        add(pnlThouShaltBeholdLayout, gridBagConstraints);
770
572
573
        typeChooserPanelContainer.setLayout(new java.awt.BorderLayout());
574
        gridBagConstraints = new java.awt.GridBagConstraints();
575
        gridBagConstraints.gridx = 0;
576
        gridBagConstraints.gridy = 1;
577
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
578
        add(typeChooserPanelContainer, gridBagConstraints);
579
580
        getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_BasicInfoVisualPanel")); // NOI18N
581
        getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_BasicInfoVisualPanel")); // NOI18N
771
    }// </editor-fold>//GEN-END:initComponents
582
    }// </editor-fold>//GEN-END:initComponents
772
    
583
    
773
    private void manageSuitePlatformActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageSuitePlatformActionPerformed
584
    private void manageSuitePlatformActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageSuitePlatformActionPerformed
Lines 777-849 Link Here
777
    private void mainProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainProjectActionPerformed
588
    private void mainProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainProjectActionPerformed
778
        mainProjectTouched = true;
589
        mainProjectTouched = true;
779
    }//GEN-LAST:event_mainProjectActionPerformed
590
    }//GEN-LAST:event_mainProjectActionPerformed
780
    
591
        
781
    private void managePlatformActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_managePlatformActionPerformed
782
        managePlatform(platformValue);
783
    }//GEN-LAST:event_managePlatformActionPerformed
784
    
785
    private void managePlatform(final JComboBox platformCombo) {
592
    private void managePlatform(final JComboBox platformCombo) {
786
        NbPlatformCustomizer.showCustomizer();
593
        NbPlatformCustomizer.showCustomizer();
787
        platformCombo.setModel(new PlatformComponentFactory.NbPlatformListModel()); // refresh
594
        platformCombo.setModel(new PlatformComponentFactory.NbPlatformListModel()); // refresh
788
        platformCombo.requestFocus();
595
        platformCombo.requestFocus();
789
        updateAndCheck();
596
        updateAndCheck();
790
    }
597
    }
791
    
598
                    
792
    private void platformChosen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_platformChosen
793
        updateAndCheck();
794
    }//GEN-LAST:event_platformChosen
795
    
796
    private void moduleSuiteChosen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleSuiteChosen
797
        if (!locationUpdated) {
798
            String suite = (String) moduleSuiteValue.getSelectedItem();
799
            computeAndSetLocation(suite, true);
800
            lastSelectedSuite = suite;
801
        }
802
        updateAndCheck();
803
    }//GEN-LAST:event_moduleSuiteChosen
804
    
805
    private void browseModuleSuite(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseModuleSuite
806
        JFileChooser chooser = ProjectChooser.projectChooser();
807
        int option = chooser.showOpenDialog(this);
808
        if (option == JFileChooser.APPROVE_OPTION) {
809
            File projectDir = chooser.getSelectedFile();
810
            UIUtil.setProjectChooserDirParent(projectDir);
811
            try {
812
                Project suite = ProjectManager.getDefault().findProject(
813
                        FileUtil.toFileObject(projectDir));
814
                if (suite != null) {
815
                    String suiteDir = SuiteUtils.getSuiteDirectoryPath(suite);
816
                    if (suiteDir != null) {
817
                        // register for this session
818
                        PlatformComponentFactory.addUserSuite(suiteDir);
819
                        // add to current combobox
820
                        moduleSuiteValue.addItem(suiteDir);
821
                        moduleSuiteValue.setSelectedItem(suiteDir);
822
                    } else {
823
                        DialogDisplayer.getDefault().notify(new DialogDescriptor.Message(
824
                                NbBundle.getMessage(BasicInfoVisualPanel.class, "MSG_NotRegularSuite",
825
                                ProjectUtils.getInformation(suite).getDisplayName())));
826
                    }
827
                }
828
            } catch (IOException e) {
829
                ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
830
            }
831
        }
832
    }//GEN-LAST:event_browseModuleSuite
833
    
834
    private void typeChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeChanged
835
        if (!mainProjectTouched) {
836
            mainProject.setSelected(isStandAlone());
837
        }
838
        if (!locationUpdated) {
839
            setInitialLocation();
840
        }
841
        if (!nameUpdated) {
842
            setInitialProjectName();
843
        }
844
        updateAndCheck();
845
    }//GEN-LAST:event_typeChanged
846
    
847
    private void browseLocation(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLocation
599
    private void browseLocation(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLocation
848
        JFileChooser chooser = new JFileChooser(getLocationValue());
600
        JFileChooser chooser = new JFileChooser(getLocationValue());
849
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
601
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Lines 855-862 Link Here
855
    
607
    
856
    // Variables declaration - do not modify//GEN-BEGIN:variables
608
    // Variables declaration - do not modify//GEN-BEGIN:variables
857
    private javax.swing.JButton browseButton;
609
    private javax.swing.JButton browseButton;
858
    private javax.swing.JButton browseSuiteButton;
859
    private javax.swing.JLabel chooserFiller;
860
    private javax.swing.JLabel filler;
610
    private javax.swing.JLabel filler;
861
    private javax.swing.JLabel folderLbl;
611
    private javax.swing.JLabel folderLbl;
862
    private javax.swing.JTextField folderValue;
612
    private javax.swing.JTextField folderValue;
Lines 864-885 Link Here
864
    private javax.swing.JLabel locationLbl;
614
    private javax.swing.JLabel locationLbl;
865
    private javax.swing.JTextField locationValue;
615
    private javax.swing.JTextField locationValue;
866
    private javax.swing.JCheckBox mainProject;
616
    private javax.swing.JCheckBox mainProject;
867
    private javax.swing.JButton managePlatform;
868
    private javax.swing.JButton manageSuitePlatform;
617
    private javax.swing.JButton manageSuitePlatform;
869
    private javax.swing.JLabel moduleSuite;
870
    private javax.swing.JComboBox moduleSuiteValue;
871
    private javax.swing.ButtonGroup moduleTypeGroup;
618
    private javax.swing.ButtonGroup moduleTypeGroup;
872
    private javax.swing.JLabel nameLbl;
619
    private javax.swing.JLabel nameLbl;
873
    javax.swing.JTextField nameValue;
620
    javax.swing.JTextField nameValue;
874
    private javax.swing.JLabel platform;
875
    private javax.swing.JComboBox platformValue;
876
    private javax.swing.JPanel pnlThouShaltBeholdLayout;
621
    private javax.swing.JPanel pnlThouShaltBeholdLayout;
877
    private javax.swing.JSeparator separator3;
622
    private javax.swing.JSeparator separator3;
878
    private javax.swing.JRadioButton standAloneModule;
879
    private javax.swing.JRadioButton suiteComponent;
880
    private javax.swing.JLabel suitePlatform;
623
    private javax.swing.JLabel suitePlatform;
881
    private javax.swing.JComboBox suitePlatformValue;
624
    private javax.swing.JComboBox suitePlatformValue;
882
    private javax.swing.JPanel typeChooserPanel;
625
    private javax.swing.JPanel typeChooserPanelContainer;
883
    // End of variables declaration//GEN-END:variables
626
    // End of variables declaration//GEN-END:variables
884
    
627
    
628
    private TypeChooserPanelImpl typeChooserPanel;
885
}
629
}
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/BasicVisualPanel.java (-3 / +3 lines)
Lines 166-180 Link Here
166
        }
166
        }
167
        
167
        
168
        protected boolean isSuiteWizard() {
168
        protected boolean isSuiteWizard() {
169
            return getData().getWizardType() == NewNbModuleWizardIterator.Type.SUITE || getData().getWizardType() == NewNbModuleWizardIterator.Type.APPLICATION;
169
            return NewNbModuleWizardIterator.isSuiteWizard(getData().getWizardType());
170
        }
170
        }
171
        
171
        
172
        protected boolean isSuiteComponentWizard() {
172
        protected boolean isSuiteComponentWizard() {
173
            return getData().getWizardType() == NewNbModuleWizardIterator.Type.SUITE_COMPONENT;
173
            return NewNbModuleWizardIterator.isSuiteComponentWizard(getData().getWizardType());
174
        }
174
        }
175
175
176
        protected boolean isLibraryWizard() {
176
        protected boolean isLibraryWizard() {
177
            return getData().getWizardType() == NewNbModuleWizardIterator.Type.LIBRARY_MODULE;
177
            return NewNbModuleWizardIterator.isLibraryWizard(getData().getWizardType());
178
        }
178
        }
179
        
179
        
180
    }
180
    }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties (-2 / +1 lines)
Lines 63-69 Link Here
63
LBL_ProjectFolder=Project Fol&der:
63
LBL_ProjectFolder=Project Fol&der:
64
LBL_ProjectLocation=Project &Location:
64
LBL_ProjectLocation=Project &Location:
65
LBL_ProjectName=Project &Name:
65
LBL_ProjectName=Project &Name:
66
MSG_ChooseRegularSuite=Regular suite must be chosen
67
MSG_ChosenPlatformIsInvalid=The selected platform is invalid. You may choose a valid one or resolve the invalid platform in NetBeans Platform Manager.
66
MSG_ChosenPlatformIsInvalid=The selected platform is invalid. You may choose a valid one or resolve the invalid platform in NetBeans Platform Manager.
68
MSG_ClassInDefaultPackage=There are classes in the default package in {0}
67
MSG_ClassInDefaultPackage=There are classes in the default package in {0}
69
MSG_Invalid_Library_Path=Library JAR does not exist
68
MSG_Invalid_Library_Path=Library JAR does not exist
Lines 80-86 Link Here
80
TXT_Library=library{0}
79
TXT_Library=library{0}
81
TXT_Module=module{0}
80
TXT_Module=module{0}
82
TXT_Suite=suite{0}
81
TXT_Suite=suite{0}
83
ACS_BasicInfoVisualPanel=
82
ACS_BasicInfoVisualPanel=Basic Information panel
84
ACS_CTL_BrowseButton=Browse
83
ACS_CTL_BrowseButton=Browse
85
ACS_CTL_BrowseSuiteButton=Browse Suite
84
ACS_CTL_BrowseSuiteButton=Browse Suite
86
ACS_CTL_FolderValue=Project Folder
85
ACS_CTL_FolderValue=Project Folder
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/wizard/NewNbModuleWizardIterator.java (-1 / +13 lines)
Lines 152-158 Link Here
152
    public static NewNbModuleWizardIterator createLibraryModuleIterator() {
152
    public static NewNbModuleWizardIterator createLibraryModuleIterator() {
153
        return new NewNbModuleWizardIterator(Type.LIBRARY_MODULE);
153
        return new NewNbModuleWizardIterator(Type.LIBRARY_MODULE);
154
    }
154
    }
155
    
155
156
    static boolean isSuiteWizard(Type type) {
157
        return type == Type.SUITE || type == Type.APPLICATION;
158
    }
159
160
    static boolean isSuiteComponentWizard(Type type) {
161
        return type == Type.SUITE_COMPONENT;
162
    }
163
164
    static boolean isLibraryWizard(Type type) {
165
        return type == Type.LIBRARY_MODULE;
166
    }
167
156
    public FileObject getCreateProjectFolder() {
168
    public FileObject getCreateProjectFolder() {
157
        return createdProjectFolder;
169
        return createdProjectFolder;
158
    }
170
    }
(-)15806e5514ac (+230 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
5
    <Component class="javax.swing.ButtonGroup" name="moduleTypeGroup">
6
    </Component>
7
  </NonVisualComponents>
8
  <AuxValues>
9
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
10
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
11
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
13
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
14
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
15
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
16
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
17
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
18
  </AuxValues>
19
20
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
21
  <SubComponents>
22
    <Container class="javax.swing.JPanel" name="typeChooserPanel">
23
      <Constraints>
24
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
25
          <BorderConstraints direction="Center"/>
26
        </Constraint>
27
      </Constraints>
28
29
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
30
      <SubComponents>
31
        <Component class="javax.swing.JRadioButton" name="standAloneModule">
32
          <Properties>
33
            <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
34
              <ComponentRef name="moduleTypeGroup"/>
35
            </Property>
36
            <Property name="selected" type="boolean" value="true"/>
37
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
38
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_StandaloneModule" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
39
            </Property>
40
          </Properties>
41
          <AccessibilityProperties>
42
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
43
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_StandAloneModule" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
44
            </Property>
45
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
46
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_StandAloneModule" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
47
            </Property>
48
          </AccessibilityProperties>
49
          <Events>
50
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="standAloneModuleTypeChanged"/>
51
          </Events>
52
          <AuxValues>
53
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
54
          </AuxValues>
55
          <Constraints>
56
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
57
              <GridBagConstraints gridX="0" gridY="0" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="6" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
58
            </Constraint>
59
          </Constraints>
60
        </Component>
61
        <Component class="javax.swing.JLabel" name="platform">
62
          <Properties>
63
            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
64
              <ComponentRef name="platformValue"/>
65
            </Property>
66
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
67
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="LBL_NetBeansPlatform" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
68
            </Property>
69
          </Properties>
70
          <AuxValues>
71
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
72
          </AuxValues>
73
          <Constraints>
74
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
75
              <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="18" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
76
            </Constraint>
77
          </Constraints>
78
        </Component>
79
        <Component class="javax.swing.JComboBox" name="platformValue">
80
          <AccessibilityProperties>
81
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
82
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_PlatformValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
83
            </Property>
84
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
85
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_PlatformValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
86
            </Property>
87
          </AccessibilityProperties>
88
          <Events>
89
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="platformChosen"/>
90
          </Events>
91
          <AuxValues>
92
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="PlatformComponentFactory.getNbPlatformsComboxBox();"/>
93
          </AuxValues>
94
          <Constraints>
95
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
96
              <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
97
            </Constraint>
98
          </Constraints>
99
        </Component>
100
        <Component class="javax.swing.JButton" name="managePlatform">
101
          <Properties>
102
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
103
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_ManagePlatforms_g" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
104
            </Property>
105
          </Properties>
106
          <AccessibilityProperties>
107
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
108
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_ManagePlatform" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
109
            </Property>
110
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
111
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_ManagePlatform" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
112
            </Property>
113
          </AccessibilityProperties>
114
          <Events>
115
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="managePlatformActionPerformed"/>
116
          </Events>
117
          <AuxValues>
118
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
119
          </AuxValues>
120
          <Constraints>
121
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
122
              <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
123
            </Constraint>
124
          </Constraints>
125
        </Component>
126
        <Component class="javax.swing.JRadioButton" name="suiteComponent">
127
          <Properties>
128
            <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
129
              <ComponentRef name="moduleTypeGroup"/>
130
            </Property>
131
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
132
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_AddToModuleSuite" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
133
            </Property>
134
          </Properties>
135
          <AccessibilityProperties>
136
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
137
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_SuiteModule" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
138
            </Property>
139
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
140
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_SuiteModule" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
141
            </Property>
142
          </AccessibilityProperties>
143
          <Events>
144
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="suiteComponentTypeChanged"/>
145
          </Events>
146
          <AuxValues>
147
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
148
          </AuxValues>
149
          <Constraints>
150
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
151
              <GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="18" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
152
            </Constraint>
153
          </Constraints>
154
        </Component>
155
        <Component class="javax.swing.JLabel" name="moduleSuite">
156
          <Properties>
157
            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
158
              <ComponentRef name="moduleSuiteValue"/>
159
            </Property>
160
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
161
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="LBL_ModuleSuite" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
162
            </Property>
163
          </Properties>
164
          <AuxValues>
165
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
166
          </AuxValues>
167
          <Constraints>
168
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
169
              <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="18" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
170
            </Constraint>
171
          </Constraints>
172
        </Component>
173
        <Component class="javax.swing.JComboBox" name="moduleSuiteValue">
174
          <AccessibilityProperties>
175
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
176
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_ModuleSuiteValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
177
            </Property>
178
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
179
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_ModuleSuiteValue" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
180
            </Property>
181
          </AccessibilityProperties>
182
          <Events>
183
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moduleSuiteChosen"/>
184
          </Events>
185
          <AuxValues>
186
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="getDefaultSuitesComboBox();"/>
187
          </AuxValues>
188
          <Constraints>
189
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
190
              <GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
191
            </Constraint>
192
          </Constraints>
193
        </Component>
194
        <Component class="javax.swing.JButton" name="browseSuiteButton">
195
          <Properties>
196
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
197
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="CTL_BrowseButton_w" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
198
            </Property>
199
          </Properties>
200
          <AccessibilityProperties>
201
            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
202
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_BrowseSuiteButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
203
            </Property>
204
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
205
              <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/wizard/Bundle.properties" key="ACS_CTL_BrowseSuiteButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
206
            </Property>
207
          </AccessibilityProperties>
208
          <Events>
209
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseModuleSuite"/>
210
          </Events>
211
          <AuxValues>
212
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
213
          </AuxValues>
214
          <Constraints>
215
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
216
              <GridBagConstraints gridX="2" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
217
            </Constraint>
218
          </Constraints>
219
        </Component>
220
        <Component class="javax.swing.JLabel" name="chooserFiller">
221
          <Constraints>
222
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
223
              <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/>
224
            </Constraint>
225
          </Constraints>
226
        </Component>
227
      </SubComponents>
228
    </Container>
229
  </SubComponents>
230
</Form>
(-)15806e5514ac (+639 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
4
 * Copyright 2008 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 2008 Sun Microsystems, Inc.
38
 */
39
package org.netbeans.modules.apisupport.project.ui.wizard;
40
41
import java.beans.PropertyChangeEvent;
42
import java.beans.PropertyChangeListener;
43
import java.io.File;
44
import java.io.IOException;
45
import javax.swing.ButtonModel;
46
import javax.swing.JComboBox;
47
import javax.swing.JFileChooser;
48
import org.netbeans.api.project.Project;
49
import org.netbeans.api.project.ProjectManager;
50
import org.netbeans.api.project.ProjectUtils;
51
import org.netbeans.modules.apisupport.project.ui.UIUtil;
52
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
53
import org.netbeans.modules.apisupport.project.ui.platform.PlatformComponentFactory;
54
import org.netbeans.modules.apisupport.project.ui.wizard.NewNbModuleWizardIterator.Type;
55
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
56
import org.netbeans.modules.apisupport.project.ui.platform.NbPlatformCustomizer;
57
import org.netbeans.spi.project.ui.support.ProjectChooser;
58
import org.openide.DialogDescriptor;
59
import org.openide.DialogDisplayer;
60
import org.openide.ErrorManager;
61
import org.openide.WizardDescriptor;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.NbBundle;
64
65
/**
66
 *
67
 * @author  akorostelev
68
 */
69
public class TypeChooserPanelImpl  extends javax.swing.JPanel{
70
71
    public final static String IS_STANDALONE_OR_SUITE_COMPONENT 
72
                                                = "tc_isStandaloneOrSuiteComp"; // NOI18N
73
74
    /** 
75
     * Suite root directory.
76
     * key for String value. 
77
     */
78
    public final static String SUITE_ROOT       = "tc_suiteRoot";               // NOI18N
79
80
    /** 
81
     * Active platform ID value to be used as value 
82
     * for nbplatform.active property in platform.properties file.
83
     * key for String value. 
84
     */
85
    public final static String ACTIVE_PLATFORM_ID  = "tc_activePlatform_id";          // NOI18N
86
87
    /** 
88
     * Active platform Object. 
89
     * key for org.netbeans.modules.apisupport.project.universe.NbPlatform value. 
90
     */
91
    public final static String ACTIVE_NB_PLATFORM  = "tc_activeNBPlatform";  // NOI18N
92
    
93
    /** 
94
     * true if project is created in NetBeans sources.
95
     * key for Boolean value. 
96
     */
97
    public final static String IS_NETBEANS_ORG = "isNetBeansOrg";            // NOI18N
98
99
    /** 
100
     * Is used to provide project's folder to TypeChooserPanel.
101
     * Is used by TypeChooserPanel implementation to decide whether specified forder 
102
     * is in NetBeans.org repository.
103
     * key for File value. 
104
     */
105
    public final static String PROJECT_FOLDER = "tc_projectFolderForTypeChooser"; // NOI18N
106
107
    private ButtonModel lastSelectedType;
108
    private static String lastSelectedSuite;
109
    private boolean moduleTypeGroupAttached = false;
110
    private WizardDescriptor settings;
111
    private Type wizardType;
112
    
113
    public TypeChooserPanelImpl(final WizardDescriptor settings) {
114
        this();
115
        this.settings = settings;
116
        attachModuleTypeGroup();
117
        storeInitialValuesToWD(getSettings());
118
        attachPropertyChangeListener(getSettings());
119
    }
120
121
    TypeChooserPanelImpl() {
122
        initComponents();
123
        init();
124
    }
125
    
126
    /** Creates new form TypeChooserPanel */
127
    TypeChooserPanelImpl(final WizardDescriptor settings, Type wizardType) {
128
        this();
129
        this.settings = settings;
130
        this.wizardType = wizardType;
131
        storeInitialValuesToWD(getSettings());
132
        attachPropertyChangeListener(getSettings());
133
        switch (wizardType) {
134
            case SUITE:
135
            case APPLICATION:
136
                detachModuleTypeGroup();
137
                break;
138
            case LIBRARY_MODULE:
139
                moduleSuite.setText(NbBundle.getMessage(
140
                        TypeChooserPanelImpl.class, "LBL_Add_to_Suite")); // NOI18N
141
                suiteComponent.setSelected(true);
142
                if (moduleSuiteValue.getItemCount() > 0) {
143
                    restoreSelectedSuite();
144
                }
145
                break;
146
            case MODULE:
147
            case SUITE_COMPONENT:
148
            default:
149
                if (moduleSuiteValue.getItemCount() > 0) {
150
                    restoreSelectedSuite();
151
                    suiteComponent.setSelected(true);
152
                }
153
        }
154
    }
155
    
156
    protected static JComboBox getDefaultSuitesComboBox(){
157
        return PlatformComponentFactory.getSuitesComboBox();
158
    }
159
    
160
    private boolean isStandAlone() {
161
        return standAloneModule.isSelected();
162
    }
163
    
164
    private boolean isSuiteComponent() {
165
        return suiteComponent.isSelected();
166
    }
167
    
168
    private String getSelectedSuite() {
169
        return (String) moduleSuiteValue.getSelectedItem();
170
    }
171
    
172
    private boolean isNetBeansOrgFolder() {
173
        File folder = ModuleTypePanelExtended.getProjectFolder(getSettings());
174
        if (folder != null){
175
            return BasicInfoVisualPanel.isNetBeansOrgFolder(folder);
176
        }
177
        return false;
178
    }
179
    
180
    private String getSelectedPlatformId() {
181
        Object selected = platformValue.getSelectedItem();
182
        if (selected != null){
183
            return ((NbPlatform) platformValue.getSelectedItem()).getID();
184
        } else {
185
            return null;
186
        }
187
    }
188
    private NbPlatform getSelectedNbPlatform() {
189
        Object selected = platformValue.getSelectedItem();
190
        if (selected != null){
191
            return (NbPlatform) platformValue.getSelectedItem();
192
        } else {
193
            return null;
194
        }
195
    }
196
    
197
    protected void setComponentsVisibility(boolean isSuiteComponentWizard, 
198
            boolean isLibraryWizard)
199
    {
200
        suiteComponent.setVisible(!isLibraryWizard);
201
        platform.setVisible(!isLibraryWizard);
202
        platformValue.setVisible(!isLibraryWizard);
203
        managePlatform.setVisible(!isLibraryWizard);
204
        standAloneModule.setVisible(!isLibraryWizard);
205
        
206
        standAloneModule.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
207
        platform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
208
        platformValue.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
209
        managePlatform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
210
        suiteComponent.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
211
        
212
    }
213
    
214
    private void updateEnabled(){
215
        boolean isNetBeansOrg = isNetBeansOrgFolder();
216
        standAloneModule.setEnabled(!isNetBeansOrg);
217
        suiteComponent.setEnabled(!isNetBeansOrg);
218
        
219
        boolean standalone = isStandAlone();
220
        boolean suiteModuleSelected = isSuiteComponent();
221
        platform.setEnabled(standalone);
222
        platformValue.setEnabled(standalone);
223
        managePlatform.setEnabled(standalone);
224
        moduleSuite.setEnabled(suiteModuleSelected);
225
        moduleSuiteValue.setEnabled(suiteModuleSelected && !isOneSuiteDedicatedMode());
226
        browseSuiteButton.setEnabled(suiteModuleSelected && !isOneSuiteDedicatedMode());
227
    }
228
    
229
    private void projectFolderIsUpdated() {
230
        
231
        if (isSuiteWizard(getWizardType()) || isNetBeansOrgFolder()) {
232
            detachModuleTypeGroup();
233
        } else {
234
            attachModuleTypeGroup();
235
        }
236
        updateEnabled();
237
        ModuleTypePanelExtended.setIsNetBeansOrg(getSettings(), isNetBeansOrgFolder());
238
    }
239
240
    private void storeInitialValuesToWD(WizardDescriptor settings){
241
        ModuleTypePanelExtended.setIsNetBeansOrg(settings, isNetBeansOrgFolder());
242
        ModuleTypePanelExtended.setIsStandaloneOrSuiteComponent(settings, isStandAlone());
243
        ModuleTypePanelExtended.setSuiteRoot(settings, getSelectedSuite());
244
        ModuleTypePanelExtended.setActivePlatformId(settings, getSelectedPlatformId());
245
        ModuleTypePanelExtended.setActiveNbPlatform(settings, getSelectedNbPlatform());
246
    }
247
248
    private void attachPropertyChangeListener(WizardDescriptor settings){
249
        settings.addPropertyChangeListener(new ProjectFolderChangeListener());
250
    }
251
        
252
    private void detachModuleTypeGroup() {
253
        if (moduleTypeGroupAttached) {
254
            lastSelectedType = moduleTypeGroup.getSelection();
255
            moduleTypeGroup.remove(standAloneModule);
256
            moduleTypeGroup.remove(suiteComponent);
257
            standAloneModule.setSelected(false);
258
            suiteComponent.setSelected(false);
259
            ModuleTypePanelExtended.setIsStandaloneOrSuiteComponent(getSettings(), null);
260
            moduleTypeGroupAttached = false;
261
        }
262
    }
263
    
264
    /**
265
     * Adds radiobuttons to ButtonGroup and sets selection.
266
     */
267
    protected void attachModuleTypeGroup() {
268
        if (!moduleTypeGroupAttached) {
269
            moduleTypeGroup.add(standAloneModule);
270
            moduleTypeGroup.add(suiteComponent);
271
            if (isLibraryWizard(getWizardType())) {
272
                suiteComponent.setSelected(true);
273
            } else {
274
                moduleTypeGroup.setSelected(lastSelectedType, true);
275
            }
276
            moduleTypeGroupAttached = true;
277
        }
278
    }
279
    
280
    private void init(){
281
        BasicInfoVisualPanel.initPlatformCombo(platformValue);
282
        if (moduleSuiteValue.getItemCount() > 0) {
283
            restoreSelectedSuite();
284
            suiteComponent.setSelected(true);
285
        }
286
    }
287
    
288
    private void restoreSelectedSuite() {
289
        String preferredSuiteDir  = getPreferredSuiteDir();
290
        if (preferredSuiteDir != null) {
291
            lastSelectedSuite = preferredSuiteDir;
292
        }
293
        if (lastSelectedSuite != null) {
294
            int max = moduleSuiteValue.getModel().getSize();
295
            for (int i=0; i < max; i++) {
296
                if (lastSelectedSuite.equals(moduleSuiteValue.getModel().getElementAt(i))) {
297
                    moduleSuiteValue.setSelectedItem(lastSelectedSuite);
298
                    break;
299
                }
300
            }
301
        }
302
    }
303
    
304
    private String getPreferredSuiteDir() {
305
        if (getSettings() != null){
306
            return (String) getSettings().getProperty(NewNbModuleWizardIterator.PREFERRED_SUITE_DIR);
307
        }
308
        return null;
309
    }
310
    
311
    private boolean isOneSuiteDedicatedMode() {
312
        Boolean b = false;
313
        if (getSettings() != null){
314
            b = (Boolean) getSettings().getProperty(
315
                    NewNbModuleWizardIterator.ONE_SUITE_DEDICATED_MODE);
316
        }
317
        return b != null ? b.booleanValue() : false;
318
    }
319
    
320
    /** This method is called from within the constructor to
321
     * initialize the form.
322
     * WARNING: Do NOT modify this code. The content of this method is
323
     * always regenerated by the Form Editor.
324
     */
325
    @SuppressWarnings("unchecked")
326
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
327
    private void initComponents() {
328
        java.awt.GridBagConstraints gridBagConstraints;
329
330
        moduleTypeGroup = new javax.swing.ButtonGroup();
331
        typeChooserPanel = new javax.swing.JPanel();
332
        standAloneModule = new javax.swing.JRadioButton();
333
        platform = new javax.swing.JLabel();
334
        platformValue = PlatformComponentFactory.getNbPlatformsComboxBox();
335
        managePlatform = new javax.swing.JButton();
336
        suiteComponent = new javax.swing.JRadioButton();
337
        moduleSuite = new javax.swing.JLabel();
338
        moduleSuiteValue = getDefaultSuitesComboBox();
339
        browseSuiteButton = new javax.swing.JButton();
340
        chooserFiller = new javax.swing.JLabel();
341
342
        setLayout(new java.awt.BorderLayout());
343
344
        typeChooserPanel.setLayout(new java.awt.GridBagLayout());
345
346
        moduleTypeGroup.add(standAloneModule);
347
        standAloneModule.setSelected(true);
348
        org.openide.awt.Mnemonics.setLocalizedText(standAloneModule, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_StandaloneModule")); // NOI18N
349
        standAloneModule.addActionListener(new java.awt.event.ActionListener() {
350
            public void actionPerformed(java.awt.event.ActionEvent evt) {
351
                standAloneModuleTypeChanged(evt);
352
            }
353
        });
354
        gridBagConstraints = new java.awt.GridBagConstraints();
355
        gridBagConstraints.gridx = 0;
356
        gridBagConstraints.gridy = 0;
357
        gridBagConstraints.gridwidth = 3;
358
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
359
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
360
        typeChooserPanel.add(standAloneModule, gridBagConstraints);
361
        standAloneModule.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_StandAloneModule")); // NOI18N
362
        standAloneModule.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_StandAloneModule")); // NOI18N
363
364
        platform.setLabelFor(platformValue);
365
        org.openide.awt.Mnemonics.setLocalizedText(platform, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "LBL_NetBeansPlatform")); // NOI18N
366
        gridBagConstraints = new java.awt.GridBagConstraints();
367
        gridBagConstraints.gridx = 0;
368
        gridBagConstraints.gridy = 1;
369
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
370
        gridBagConstraints.insets = new java.awt.Insets(0, 18, 0, 12);
371
        typeChooserPanel.add(platform, gridBagConstraints);
372
373
        platformValue.addActionListener(new java.awt.event.ActionListener() {
374
            public void actionPerformed(java.awt.event.ActionEvent evt) {
375
                platformChosen(evt);
376
            }
377
        });
378
        gridBagConstraints = new java.awt.GridBagConstraints();
379
        gridBagConstraints.gridx = 1;
380
        gridBagConstraints.gridy = 1;
381
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
382
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
383
        gridBagConstraints.weightx = 1.0;
384
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
385
        typeChooserPanel.add(platformValue, gridBagConstraints);
386
        platformValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_PlatformValue")); // NOI18N
387
        platformValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_PlatformValue")); // NOI18N
388
389
        org.openide.awt.Mnemonics.setLocalizedText(managePlatform, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_ManagePlatforms_g")); // NOI18N
390
        managePlatform.addActionListener(new java.awt.event.ActionListener() {
391
            public void actionPerformed(java.awt.event.ActionEvent evt) {
392
                managePlatformActionPerformed(evt);
393
            }
394
        });
395
        gridBagConstraints = new java.awt.GridBagConstraints();
396
        gridBagConstraints.gridx = 2;
397
        gridBagConstraints.gridy = 1;
398
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
399
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
400
        typeChooserPanel.add(managePlatform, gridBagConstraints);
401
        managePlatform.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ManagePlatform")); // NOI18N
402
        managePlatform.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ManagePlatform")); // NOI18N
403
404
        moduleTypeGroup.add(suiteComponent);
405
        org.openide.awt.Mnemonics.setLocalizedText(suiteComponent, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_AddToModuleSuite")); // NOI18N
406
        suiteComponent.addActionListener(new java.awt.event.ActionListener() {
407
            public void actionPerformed(java.awt.event.ActionEvent evt) {
408
                suiteComponentTypeChanged(evt);
409
            }
410
        });
411
        gridBagConstraints = new java.awt.GridBagConstraints();
412
        gridBagConstraints.gridx = 0;
413
        gridBagConstraints.gridy = 2;
414
        gridBagConstraints.gridwidth = 3;
415
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
416
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 0, 0);
417
        typeChooserPanel.add(suiteComponent, gridBagConstraints);
418
        suiteComponent.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_SuiteModule")); // NOI18N
419
        suiteComponent.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_SuiteModule")); // NOI18N
420
421
        moduleSuite.setLabelFor(moduleSuiteValue);
422
        org.openide.awt.Mnemonics.setLocalizedText(moduleSuite, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "LBL_ModuleSuite")); // NOI18N
423
        gridBagConstraints = new java.awt.GridBagConstraints();
424
        gridBagConstraints.gridx = 0;
425
        gridBagConstraints.gridy = 3;
426
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
427
        gridBagConstraints.insets = new java.awt.Insets(6, 18, 0, 12);
428
        typeChooserPanel.add(moduleSuite, gridBagConstraints);
429
430
        moduleSuiteValue.addActionListener(new java.awt.event.ActionListener() {
431
            public void actionPerformed(java.awt.event.ActionEvent evt) {
432
                moduleSuiteChosen(evt);
433
            }
434
        });
435
        gridBagConstraints = new java.awt.GridBagConstraints();
436
        gridBagConstraints.gridx = 1;
437
        gridBagConstraints.gridy = 3;
438
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
439
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
440
        gridBagConstraints.weightx = 1.0;
441
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 12);
442
        typeChooserPanel.add(moduleSuiteValue, gridBagConstraints);
443
        moduleSuiteValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ModuleSuiteValue")); // NOI18N
444
        moduleSuiteValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ModuleSuiteValue")); // NOI18N
445
446
        org.openide.awt.Mnemonics.setLocalizedText(browseSuiteButton, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_BrowseButton_w")); // NOI18N
447
        browseSuiteButton.addActionListener(new java.awt.event.ActionListener() {
448
            public void actionPerformed(java.awt.event.ActionEvent evt) {
449
                browseModuleSuite(evt);
450
            }
451
        });
452
        gridBagConstraints = new java.awt.GridBagConstraints();
453
        gridBagConstraints.gridx = 2;
454
        gridBagConstraints.gridy = 3;
455
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
456
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
457
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
458
        typeChooserPanel.add(browseSuiteButton, gridBagConstraints);
459
        browseSuiteButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_BrowseSuiteButton")); // NOI18N
460
        browseSuiteButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_BrowseSuiteButton")); // NOI18N
461
462
        gridBagConstraints = new java.awt.GridBagConstraints();
463
        gridBagConstraints.gridx = 0;
464
        gridBagConstraints.gridy = 4;
465
        gridBagConstraints.weighty = 1.0;
466
        typeChooserPanel.add(chooserFiller, gridBagConstraints);
467
468
        add(typeChooserPanel, java.awt.BorderLayout.CENTER);
469
    }// </editor-fold>//GEN-END:initComponents
470
471
private void standAloneModuleTypeChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_standAloneModuleTypeChanged
472
    ModuleTypePanelExtended.setIsStandaloneOrSuiteComponent(getSettings(), isStandAlone());
473
    updateEnabled();
474
}//GEN-LAST:event_standAloneModuleTypeChanged
475
476
private void platformChosen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_platformChosen
477
    ModuleTypePanelExtended.setActivePlatformId(getSettings(), getSelectedPlatformId());
478
    ModuleTypePanelExtended.setActiveNbPlatform(getSettings(), getSelectedNbPlatform());
479
    updateEnabled();
480
}//GEN-LAST:event_platformChosen
481
482
private void managePlatformActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_managePlatformActionPerformed
483
    managePlatform(platformValue);
484
    ModuleTypePanelExtended.setActivePlatformId(getSettings(), getSelectedPlatformId());
485
    ModuleTypePanelExtended.setActiveNbPlatform(getSettings(), getSelectedNbPlatform());
486
    updateEnabled();
487
}//GEN-LAST:event_managePlatformActionPerformed
488
489
    private void managePlatform(final JComboBox platformCombo) {
490
        NbPlatformCustomizer.showCustomizer();
491
        platformCombo.setModel(new PlatformComponentFactory.NbPlatformListModel()); // refresh
492
493
        platformCombo.requestFocus();
494
    }
495
496
private void suiteComponentTypeChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_suiteComponentTypeChanged
497
    ModuleTypePanelExtended.setIsStandaloneOrSuiteComponent(getSettings(), isStandAlone());
498
    updateEnabled();
499
}//GEN-LAST:event_suiteComponentTypeChanged
500
501
private void moduleSuiteChosen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleSuiteChosen
502
    String suite = (String) moduleSuiteValue.getSelectedItem();
503
    lastSelectedSuite = suite;
504
    ModuleTypePanelExtended.setSuiteRoot(getSettings(), getSelectedSuite());
505
    updateEnabled();
506
}//GEN-LAST:event_moduleSuiteChosen
507
508
private void browseModuleSuite(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseModuleSuite
509
JFileChooser chooser = ProjectChooser.projectChooser();
510
        int option = chooser.showOpenDialog(this);
511
        if (option == JFileChooser.APPROVE_OPTION) {
512
            File projectDir = chooser.getSelectedFile();
513
            UIUtil.setProjectChooserDirParent(projectDir);
514
            try {
515
                Project suite = ProjectManager.getDefault().findProject(
516
                        FileUtil.toFileObject(projectDir));
517
                if (suite != null) {
518
                    String suiteDir = SuiteUtils.getSuiteDirectoryPath(suite);
519
                    if (suiteDir != null) {
520
                        // register for this session
521
                        PlatformComponentFactory.addUserSuite(suiteDir);
522
                        // add to current combobox
523
                        moduleSuiteValue.addItem(suiteDir);
524
                        moduleSuiteValue.setSelectedItem(suiteDir);
525
                    } else {
526
                        DialogDisplayer.getDefault().notify(new DialogDescriptor.Message(
527
                                NbBundle.getMessage(BasicInfoVisualPanel.class, "MSG_NotRegularSuite",
528
                                ProjectUtils.getInformation(suite).getDisplayName())));
529
                    }
530
                }
531
            } catch (IOException e) {
532
                ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
533
            }
534
        }
535
}//GEN-LAST:event_browseModuleSuite
536
537
538
    // Variables declaration - do not modify//GEN-BEGIN:variables
539
    private javax.swing.JButton browseSuiteButton;
540
    private javax.swing.JLabel chooserFiller;
541
    private javax.swing.JButton managePlatform;
542
    private javax.swing.JLabel moduleSuite;
543
    private javax.swing.JComboBox moduleSuiteValue;
544
    private javax.swing.ButtonGroup moduleTypeGroup;
545
    private javax.swing.JLabel platform;
546
    private javax.swing.JComboBox platformValue;
547
    private javax.swing.JRadioButton standAloneModule;
548
    private javax.swing.JRadioButton suiteComponent;
549
    private javax.swing.JPanel typeChooserPanel;
550
    // End of variables declaration//GEN-END:variables
551
552
    
553
    
554
    protected WizardDescriptor getSettings(){
555
        return settings;
556
    }
557
    
558
    private Type getWizardType(){
559
        return this.wizardType;
560
    }
561
562
    private static boolean isSuiteWizard(Type type) {
563
        return type != null 
564
            ? NewNbModuleWizardIterator.isSuiteWizard(type)
565
            : false;
566
    }
567
568
    private static boolean isLibraryWizard(Type type) {
569
        return type != null 
570
            ? NewNbModuleWizardIterator.isLibraryWizard(type)
571
            : false;
572
    }
573
574
    private class ProjectFolderChangeListener extends ModuleTypePanelExtended
575
            implements PropertyChangeListener 
576
    {
577
578
        public void propertyChange(PropertyChangeEvent evt) {
579
            String name = evt.getPropertyName();
580
581
            if (PROJECT_FOLDER.equals(name)) {
582
                projectFolderIsUpdated();
583
            }
584
        }
585
    }
586
    
587
    /**
588
     * Extends org.netbeans.modules.apisupport.project.ui.wizard.spi.ModuleTypePanel
589
     * functionality. Doesn't extends ModuleTypePanel directly, because 
590
     * ModuleTypePanel constructor is private.
591
     */
592
    private static class ModuleTypePanelExtended {
593
        
594
        protected static void setIsStandaloneOrSuiteComponent(
595
                WizardDescriptor settings, Boolean value)
596
        {
597
            if (settings != null){
598
                settings.putProperty(IS_STANDALONE_OR_SUITE_COMPONENT, value);
599
            }
600
        }
601
        
602
        protected static void setIsNetBeansOrg( WizardDescriptor settings, Boolean value) {
603
            if (settings != null){
604
                settings.putProperty(IS_NETBEANS_ORG, value);
605
            }
606
        }
607
        
608
        protected static void setActivePlatformId( WizardDescriptor settings, String value) {
609
            if (settings != null){
610
                settings.putProperty(ACTIVE_PLATFORM_ID, value);
611
            }
612
        }
613
        
614
        protected static void setActiveNbPlatform( WizardDescriptor settings, NbPlatform value) {
615
            if (settings != null){
616
                settings.putProperty(ACTIVE_NB_PLATFORM, value);
617
            }
618
        }
619
        
620
        protected static void setSuiteRoot( WizardDescriptor settings, String value) {
621
            if (settings != null){
622
                settings.putProperty(SUITE_ROOT, value);
623
            }
624
        }
625
        
626
        protected static File getProjectFolder( WizardDescriptor settings) {
627
            if (settings != null) {
628
                Object value = settings.getProperty(PROJECT_FOLDER);
629
                if (value != null && value instanceof File) {
630
                    return (File) value;
631
                }
632
            }
633
            return null;
634
        }
635
        
636
        
637
    }
638
639
}
(-)15806e5514ac (+41 lines)
Added Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
4
#
5
# The contents of this file are subject to the terms of either the GNU
6
# General Public License Version 2 only ("GPL") or the Common
7
# Development and Distribution License("CDDL") (collectively, the
8
# "License"). You may not use this file except in compliance with the
9
# License. You can obtain a copy of the License at
10
# http://www.netbeans.org/cddl-gplv2.html
11
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12
# specific language governing permissions and limitations under the
13
# License.  When distributing the software, include this License Header
14
# Notice in each file and include the License file at
15
# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
16
# particular file as subject to the "Classpath" exception as provided
17
# by Sun in the GPL Version 2 section of the License file that
18
# accompanied this code. If applicable, add the following below the
19
# License Header, with the fields enclosed by brackets [] replaced by
20
# your own identifying information:
21
# "Portions Copyrighted [year] [name of copyright owner]"
22
#
23
# Contributor(s):
24
#
25
# The Original Software is NetBeans. The Initial Developer of the Original
26
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
27
# Microsystems, Inc. All Rights Reserved.
28
#
29
# If you wish your version of this file to be governed by only the CDDL
30
# or only the GPL Version 2, indicate your decision by adding
31
# "[Contributor] elects to include this software in this distribution
32
# under the [CDDL or GPL Version 2] license." If you do not indicate a
33
# single choice of license, a recipient has the option to distribute
34
# your version of this file under either the CDDL, the GPL Version 2 or
35
# to extend the choice of license to its licensees as provided above.
36
# However, if you add GPL Version 2 code and therefore, elected the GPL
37
# Version 2 license, then the option applies only if the new code is
38
# made subject to such option by the copyright holder.
39
40
MSG_ChooseRegularSuite=Regular suite must be chosen
41
MSG_ChosenPlatformIsInvalid=The selected platform is invalid. You may choose a valid one or resolve the invalid platform in NetBeans Platform Manager.
(-)15806e5514ac (+261 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
4
 * Copyright 2008 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 2008 Sun Microsystems, Inc.
38
 */
39
package org.netbeans.modules.apisupport.project.ui.wizard.spi;
40
41
import java.beans.PropertyChangeEvent;
42
import java.io.File;
43
import javax.swing.JComponent;
44
import org.netbeans.modules.apisupport.project.ui.wizard.TypeChooserPanelImpl;
45
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
46
import org.openide.WizardDescriptor;
47
import org.openide.util.NbBundle;
48
49
/**
50
 * Class for communicating with UI panel for embedding into the First step 
51
 * of NetBeans module project wizard.
52
 * <p>
53
 * Panel is created using createComponent(WizardDescriptor) method. It contains UI to select
54
 * <ul>
55
 *  <li>NetBeans Platform (for standalone modules)</li>
56
 *  <li>Module Suite (for suite modules)</li>
57
 * </ul>
58
 * All communication with created panel is performed through WizardDescriptor 
59
 * using static methods of ths class.
60
 * 
61
 * @author akorostelev
62
 * @since org.netbeans.modules.apisupport.project 1.23
63
 */
64
public class ModuleTypePanel{
65
66
    /** 
67
     * Key for module type property.
68
     * key for Boolean value. use 
69
     */
70
    private final static String IS_STANDALONE_OR_SUITE_COMPONENT 
71
                        = TypeChooserPanelImpl.IS_STANDALONE_OR_SUITE_COMPONENT;
72
73
    /** 
74
     * Suite root directory.
75
     * key for String value. 
76
     */
77
    private final static String SUITE_ROOT = TypeChooserPanelImpl.SUITE_ROOT;
78
79
    /** 
80
     * Active platform ID value to be used as value 
81
     * for nbplatform.active property in platform.properties file.
82
     * key for String value. 
83
     */
84
    private final static String ACTIVE_PLATFORM_ID 
85
                        = TypeChooserPanelImpl.ACTIVE_PLATFORM_ID;
86
87
    /** 
88
     * Active platform Object. 
89
     * key for org.netbeans.modules.apisupport.project.universe.NbPlatform value. 
90
     */
91
    private final static String ACTIVE_NB_PLATFORM  
92
                        = TypeChooserPanelImpl.ACTIVE_NB_PLATFORM;
93
    
94
    /** 
95
     * true if project is created in NetBeans sources.
96
     * key for Boolean value. 
97
     */
98
    private final static String IS_NETBEANS_ORG 
99
                        = TypeChooserPanelImpl.IS_NETBEANS_ORG;
100
101
    /** 
102
     * Is used to provide project's folder to TypeChooserPanel.
103
     * Is used by TypeChooserPanel implementation to decide whether specified forder 
104
     * is in NetBeans.org repository.
105
     * key for File value. 
106
     */
107
    private final static String PROJECT_FOLDER 
108
                        = TypeChooserPanelImpl.PROJECT_FOLDER;
109
110
    /**
111
     * private constructor to prevent direct instantiation.
112
     */
113
    private ModuleTypePanel() {
114
    }
115
    
116
    /**
117
     * creates Panel's UI Component.
118
     * @param wizard Wizard descriptor to be used for getting property changge updates from Component.
119
     * @return JComponent Panel object
120
     */
121
    public static JComponent createComponent(WizardDescriptor wizard) {
122
        return (JComponent) new TypeChooserPanelImpl(wizard);
123
    }
124
125
    /**
126
     * validates panel. Error messages should be added to provided settings 
127
     * by setting WizardDescriptor.PROP_ERROR_MESSAGE property value:
128
     * <pre>
129
     * settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, message); 
130
     * </pre>
131
     * @param settings 
132
     * @return true if panel is valid. false otherwise.
133
     */
134
    public static boolean validate(WizardDescriptor settings) {
135
        if (isSuiteComponent(settings) && getSuiteRoot(settings) == null) {
136
            setErrorMessage(settings, NbBundle.getMessage(
137
                    ModuleTypePanel.class, "MSG_ChooseRegularSuite"));// NOI18N
138
            return false;
139
        } else if (isStandalone(settings) &&
140
                (getActiveNbPlatform(settings) == null || !(getActiveNbPlatform(settings)).isValid())) {
141
            setErrorMessage(settings, NbBundle.getMessage(
142
                    ModuleTypePanel.class, "MSG_ChosenPlatformIsInvalid"));// NOI18N
143
            return false;
144
        }
145
        return true;
146
    }
147
148
    /**
149
     * Should be used by WizardDecriptor PropertyChangeListener
150
     * to test if receined PropertyChangeEvent is caused by changes in panel.
151
     * <p>
152
     * New values can be got using 
153
     * isSuiteComponent(WizardDescriptor), isStandalone(WizardDescriptor),
154
     * getSuiteRoot(WizardDescriptor), getActivePlatformId(WizardDescriptor)
155
     * methods.
156
     * @param evt PropertyChangeEvent
157
     * @return true is module type, module suite or active platform selection is changed.
158
     */
159
    public static boolean isPanelUpdated(PropertyChangeEvent evt){
160
        String name = evt.getPropertyName();
161
        if (IS_STANDALONE_OR_SUITE_COMPONENT.equals(name)
162
                || SUITE_ROOT.equals(name)
163
                || ACTIVE_PLATFORM_ID.equals(name))
164
        {
165
            return true;
166
        }
167
        return false;
168
    }
169
    
170
    /**
171
     * Notifies panel that project folder is changed 
172
     * and panel UI should be updated.
173
     * @param settings Wizard descriptor 
174
     * @param folder new Project folder value
175
     */
176
    public static void setProjectFolder(WizardDescriptor settings, File value) {
177
        settings.putProperty(PROJECT_FOLDER, value);
178
    }
179
        
180
    /**
181
     * Checks in Wizard Descriptor properties if "Add To Module Suite" was selected 
182
     * on Component created using createComponent(WizardDescriptor).
183
     * @param wizard Wizard descriptor 
184
     * @return true if "Add To Module Suite" radiobutton was selected. false if not. 
185
     */
186
    public static boolean isSuiteComponent(WizardDescriptor wizard){
187
        Object value = wizard.getProperty(IS_STANDALONE_OR_SUITE_COMPONENT);
188
        return !extractBoolean(value, true);
189
    }
190
    
191
    /**
192
     * Checks in Wizard Descriptor properties if "Standalone Module" was selected 
193
     * on Component created using createComponent(WizardDescriptor).
194
     * @param wizard Wizard descriptor 
195
     * @return true if "Standalone Module" radiobutton was selected. false if not. 
196
     */
197
    public static boolean isStandalone(WizardDescriptor wizard){
198
        Object value = wizard.getProperty(IS_STANDALONE_OR_SUITE_COMPONENT);
199
        return extractBoolean(value, false);
200
    }
201
    
202
    /**
203
     * Returns true if Module with project folder set by setProjectFolder(WizardDescriptor, File)
204
     * is NetBeans sourcees root
205
     * @param wizard Wizard descriptor 
206
     * @return true if specified Project folder is NetBeans sourcees root
207
     */
208
    public static boolean isNetBeansOrg(WizardDescriptor wizard){
209
        Object value = wizard.getProperty(IS_NETBEANS_ORG);
210
        return extractBoolean(value, false);
211
    }
212
    
213
    /**
214
     * Returns suite root directory stored in wizard descriptor by 
215
     * Component created using createComponent(WizardDescriptor).
216
     * @param wizard Wizard descriptor 
217
     * @return suite root directory
218
     */
219
    public static String getSuiteRoot(WizardDescriptor wizard){
220
        Object value = wizard.getProperty(SUITE_ROOT);
221
        return extractString(value, null);
222
    }
223
    
224
    /**
225
     * Returns platform id stored in wizard descriptor by 
226
     * Component created using createComponent(WizardDescriptor).
227
     * @param wizard Wizard descriptor 
228
     * @return platform id
229
     */
230
    public static String getActivePlatformId(WizardDescriptor wizard){
231
        Object value = wizard.getProperty(ACTIVE_PLATFORM_ID);
232
        return extractString(value, null);
233
    }
234
    
235
    private static NbPlatform getActiveNbPlatform(WizardDescriptor wizard){
236
        Object value = wizard.getProperty(ACTIVE_NB_PLATFORM);
237
        if (value != null && value instanceof NbPlatform){
238
            return (NbPlatform)value;
239
        }
240
        return null;
241
    }
242
    
243
    private static boolean extractBoolean(Object value, boolean defaultValue){
244
        if (value != null && value instanceof Boolean){
245
            return (Boolean)value;
246
        }
247
        return defaultValue;
248
    }
249
    
250
    private static String extractString(Object value, String defaultValue){
251
        if (value != null && value instanceof String){
252
            return (String)value;
253
        }
254
        return defaultValue;
255
    }
256
    
257
    private static void setErrorMessage(WizardDescriptor settings, String message) {
258
        settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, message); 
259
    }
260
261
}
(-)15806e5514ac (+187 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
4
 * Copyright 2008 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 2008 Sun Microsystems, Inc.
38
 */
39
package org.netbeans.modules.apisupport.project.ui.wizard.spi;
40
41
import java.awt.Component;
42
import java.beans.PropertyChangeEvent;
43
import java.beans.PropertyChangeListener;
44
import java.io.File;
45
import javax.swing.JComponent;
46
import org.netbeans.modules.apisupport.project.TestBase;
47
import org.netbeans.modules.apisupport.project.ui.wizard.TypeChooserPanelImpl;
48
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
49
import org.openide.WizardDescriptor;
50
import org.openide.util.test.MockPropertyChangeListener;
51
52
/**
53
 *
54
 * @author akorostelev
55
 */
56
public class ModuleTypePanelCreatorTest extends TestBase {
57
58
    public ModuleTypePanelCreatorTest(String testName) {
59
        super(testName);
60
    }
61
62
    /**
63
     * Test of create method, of class ModuleTypePanel.
64
     */
65
    public void testCreate() {
66
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
67
        JComponent result = ModuleTypePanel.createComponent(wizardDescriptor);
68
        // panel is created
69
        assertNotNull(result);
70
        // expected panel implementation is returned
71
        assertTrue(result instanceof TypeChooserPanelImpl);
72
    }
73
74
    public void testPropertyChangeNotifications() {
75
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
76
        
77
        MockPropertyChangeListener l = new MockPropertyChangeListener();
78
        wizardDescriptor.addPropertyChangeListener(l);
79
        
80
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
81
        // test that changes notifications are received
82
        ModuleTypePanel.setProjectFolder(wizardDescriptor, new File(""));
83
        
84
        l.assertEvents(TypeChooserPanelImpl.IS_NETBEANS_ORG, 
85
                TypeChooserPanelImpl.IS_STANDALONE_OR_SUITE_COMPONENT,
86
                TypeChooserPanelImpl.SUITE_ROOT,
87
                TypeChooserPanelImpl.ACTIVE_PLATFORM_ID,
88
                TypeChooserPanelImpl.ACTIVE_NB_PLATFORM,
89
                TypeChooserPanelImpl.PROJECT_FOLDER);
90
    }
91
    
92
    public void testIsPanelUpdated() {
93
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
94
        
95
        PanelUpdatedPCL l = new PanelUpdatedPCL();
96
        wizardDescriptor.addPropertyChangeListener(l);
97
        
98
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
99
        // test that changes notifications are received
100
        File nbRootfolder = new File(nbRootFile(), "testProject");//NOI18N
101
        ModuleTypePanel.setProjectFolder(wizardDescriptor, nbRootfolder);
102
        assertTrue("panel updated event type received", l.isPanelUpdatedEvent());
103
    }
104
    
105
    public void testPanelDisabledForNbOrg(){
106
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
107
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
108
109
        ModuleTypePanel.setProjectFolder(wizardDescriptor, 
110
                new File(nbRootFile(), "testProject"));
111
        
112
        assertTrue("project is in Nb Root", 
113
                ModuleTypePanel.isNetBeansOrg(wizardDescriptor));
114
        assertFalse("standalone radio buttyon is deselected",
115
                ModuleTypePanel.isStandalone(wizardDescriptor));
116
        assertFalse("suite component radio buttyon is deselected",
117
                ModuleTypePanel.isSuiteComponent(wizardDescriptor));
118
    }
119
120
    public void testPanelValuesForStandaloneModule(){
121
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
122
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
123
124
        ModuleTypePanel.setProjectFolder(wizardDescriptor, new File(""));
125
        
126
        assertFalse("project is NOT in Nb Root", 
127
                ModuleTypePanel.isNetBeansOrg(wizardDescriptor));
128
        assertTrue("standalone radios is selected",
129
                ModuleTypePanel.isStandalone(wizardDescriptor));
130
        assertNotNull("platrorm is selected",
131
                ModuleTypePanel.getActivePlatformId(wizardDescriptor));
132
        assertNotNull("platrorm is selected(test NbPlatform value)",
133
                (NbPlatform)wizardDescriptor.getProperty(TypeChooserPanelImpl.ACTIVE_NB_PLATFORM));
134
    }
135
136
    public void testIsNetBeansOrgProperty() {
137
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
138
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
139
140
        File folder = new File("");
141
        Boolean isNbOrg = isFolderNbRoot(wizardDescriptor, folder);
142
        assertNotNull(isNbOrg);
143
        assertFalse(folder.getAbsolutePath() + " folder is NOT in NetBeans Root", isNbOrg);
144
        
145
        folder = new File(nbRootFile(), "testProject");//NOI18N
146
        isNbOrg = isFolderNbRoot(wizardDescriptor, folder );
147
        assertNotNull(isNbOrg);
148
        assertTrue(folder.getAbsolutePath() + " folder is in NetBeans Root", isNbOrg);
149
        
150
    }
151
    
152
    private Boolean isFolderNbRoot(WizardDescriptor wizardDescriptor, File folder){
153
        ModuleTypePanel.setProjectFolder(wizardDescriptor, folder);
154
        return ModuleTypePanel.isNetBeansOrg(wizardDescriptor);
155
    }
156
    
157
    public void testValidate(){
158
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
159
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
160
        // test default state
161
        ModuleTypePanel.validate(wizardDescriptor);
162
        assertNull("No error messages", 
163
                wizardDescriptor.getProperty(WizardDescriptor.PROP_ERROR_MESSAGE));
164
        
165
    }
166
    
167
    private static class PanelUpdatedPCL implements PropertyChangeListener{
168
        private boolean isPanelUpdated = false;
169
170
        public PanelUpdatedPCL() {
171
            reset();
172
        }
173
        
174
        public void propertyChange(PropertyChangeEvent evt) {
175
            isPanelUpdated = isPanelUpdated || ModuleTypePanel.isPanelUpdated(evt);
176
        }
177
        
178
        public boolean isPanelUpdatedEvent(){
179
            return isPanelUpdated;
180
        }
181
                
182
        public void reset(){
183
            isPanelUpdated = false;
184
        }
185
    }
186
    
187
}

Return to bug 144060