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/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 / +160 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
        String name = evt.getPropertyName();
144
        Object value = evt.getNewValue();
145
        
146
        if (ModuleTypePanel.IS_STANDALONE_OR_SUITE_COMPONENT.equals(name)){
147
            moduletypeChanged(value);
148
        } else if (ModuleTypePanel.SUITE_ROOT.equals(name)){
149
            moduleSuiteValueChanged(value);
150
        } else if (ModuleTypePanel.ACTIVE_PLATFORM_ID.equals(name)){
151
            updateAndCheck();
152
        }
153
    }
154
    
155
    private void moduleSuiteValueChanged(Object val) {
156
        String suite = null;
157
        if (val != null && val instanceof String){
158
            suite = (String)val;
159
        }
160
        if (!locationUpdated) {
161
            computeAndSetLocation(suite, true);
162
        }
163
        updateAndCheck();
164
    }
165
166
    private void moduletypeChanged(Object val) {
167
        Boolean isStandAlone = null;
168
        if (val != null && val instanceof Boolean){
169
            isStandAlone = ((Boolean)val).booleanValue();
170
            // todo TEST
171
        }
172
        // null means both radio uttons are deselected and disaled
173
        if (isStandAlone == null){
174
            return;
175
        }
176
        
177
        if (!mainProjectTouched) {
178
            mainProject.setSelected(isStandAlone);
179
        }
180
        if (!locationUpdated) {
181
            setInitialLocation();
182
        }
183
        if (!nameUpdated) {
184
            setInitialProjectName();
185
        }
186
        updateAndCheck();
129
    }
187
    }
130
    
188
    
131
    private void setInitialLocation() {
189
    private void setInitialLocation() {
132
        if (isSuiteComponent()) {
190
        if (typeChooserPanel.isSuiteComponent()) {
133
            computeAndSetLocation((String) moduleSuiteValue.getSelectedItem(), true);
191
            computeAndSetLocation(typeChooserPanel.getSelectedSuite(), true);
134
        } else { // suite or standalone module
192
        } else { // suite or standalone module
135
            String location = computeLocationValue(ProjectChooser.getProjectsFolder().getAbsolutePath());
193
            String location = computeLocationValue(ProjectChooser.getProjectsFolder().getAbsolutePath());
136
            File locationF = new File(location);
194
            File locationF = new File(location);
Lines 142-164 Link Here
142
        }
200
        }
143
    }
201
    }
144
    
202
    
145
    private void initAccessibility() {
203
    private void initPanels(){
146
        this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_BasicInfoVisualPanel"));
204
        if (typeChooserPanel != null){
147
        browseButton.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_BrowseButton"));
205
            typeChooserPanelContainer.removeAll();
148
        browseSuiteButton.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_BrowseSuiteButton"));
206
            typeChooserPanel = null;
149
        folderValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_FolderValue"));
207
        }
150
        locationValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_LocationValue"));
208
        typeChooserPanel = new TypeChooserPanelImpl(getSettings(), getData().getWizardType());
151
        mainProject.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_MainProject"));
209
        typeChooserPanelContainer.add(typeChooserPanel);
152
        managePlatform.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ManagePlatform"));
210
        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
    }
211
    }
161
    
212
162
    private void setComponentsVisibility() {
213
    private void setComponentsVisibility() {
163
        boolean isSuiteWizard = isSuiteWizard();
214
        boolean isSuiteWizard = isSuiteWizard();
164
        boolean isSuiteComponentWizard = isSuiteComponentWizard();
215
        boolean isSuiteComponentWizard = isSuiteComponentWizard();
Lines 170-213 Link Here
170
        manageSuitePlatform.setVisible(isSuiteWizard);
221
        manageSuitePlatform.setVisible(isSuiteWizard);
171
        mainProject.setVisible(!isLibraryWizard);
222
        mainProject.setVisible(!isLibraryWizard);
172
        
223
        
173
        suiteComponent.setVisible(!isLibraryWizard);
174
        platform.setVisible(!isLibraryWizard);
175
        platformValue.setVisible(!isLibraryWizard);
176
        managePlatform.setVisible(!isLibraryWizard);
177
        standAloneModule.setVisible(!isLibraryWizard);
178
        mainProject.setSelected(!isLibraryWizard);
224
        mainProject.setSelected(!isLibraryWizard);
179
        
225
        
180
        standAloneModule.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
226
        if (typeChooserPanel != null){
181
        platform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
227
            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
        }
228
        }
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
    }
229
    }
212
    
230
    
213
    private String getNameValue() {
231
    private String getNameValue() {
Lines 222-265 Link Here
222
        return new File(getLocationValue());
240
        return new File(getLocationValue());
223
    }
241
    }
224
    
242
    
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() {
243
    void updateAndCheck() {
241
        updateGUI();
244
        updateGUI();
242
        
245
        
243
        if ("".equals(getNameValue())) {
246
        if ("".equals(getNameValue())) {
244
            setError(getMessage("MSG_NameCannotBeEmpty"));
247
            setError(NbBundle.getMessage(
248
                    BasicInfoVisualPanel.class, "MSG_NameCannotBeEmpty"));//NOI18N
245
        } else if ("".equals(getLocationValue())) {
249
        } else if ("".equals(getLocationValue())) {
246
            setError(getMessage("MSG_LocationCannotBeEmpty"));
250
            setError(NbBundle.getMessage(
251
                    BasicInfoVisualPanel.class, "MSG_LocationCannotBeEmpty"));//NOI18N
247
        } else if (isLibraryWizard() && isNetBeansOrgFolder()) {
252
        } else if (isLibraryWizard() && isNetBeansOrgFolder()) {
248
            setError(getMessage("MSG_LibraryWrapperForNBOrgUnsupported"));
253
            setError(NbBundle.getMessage(
249
        } else if (isSuiteComponent() && moduleSuiteValue.getSelectedItem() == null) {
254
                    BasicInfoVisualPanel.class, "MSG_LibraryWrapperForNBOrgUnsupported"));//NOI18N
250
            setError(getMessage("MSG_ChooseRegularSuite"));
255
        } else if (!ModuleTypePanel.validate(getSettings())) {
251
        } else if (isStandAlone() &&
256
            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() &&
257
        } else if (isSuiteWizard() &&
255
                (suitePlatformValue.getSelectedItem() == null || !((NbPlatform) suitePlatformValue.getSelectedItem()).isValid())) {
258
                (suitePlatformValue.getSelectedItem() == null || !((NbPlatform) suitePlatformValue.getSelectedItem()).isValid())) 
256
            setError(getMessage("MSG_ChosenPlatformIsInvalid"));
259
        {
260
            setError(NbBundle.getMessage(
261
                    BasicInfoVisualPanel.class, "MSG_ChosenPlatformIsInvalid"));//NOI18N
257
        } else if (getFolder().exists()) {
262
        } else if (getFolder().exists()) {
258
            setError(getMessage("MSG_ProjectFolderExists"));
263
            setError(NbBundle.getMessage(
264
                    BasicInfoVisualPanel.class, "MSG_ProjectFolderExists"));//NOI18N
259
        } else if (!getLocationFile().exists()) {
265
        } else if (!getLocationFile().exists()) {
260
            setError(getMessage("MSG_LocationMustExist"));
266
            setError(NbBundle.getMessage(
267
                    BasicInfoVisualPanel.class, "MSG_LocationMustExist"));//NOI18N
261
        } else if (!getLocationFile().canWrite()) {
268
        } else if (!getLocationFile().canWrite()) {
262
            setError(getMessage("MSG_LocationNotWritable"));
269
            setError(NbBundle.getMessage(
270
                    BasicInfoVisualPanel.class, "MSG_LocationNotWritable"));//NOI18N
263
        } else {
271
        } else {
264
            markValid();
272
            markValid();
265
        }
273
        }
Lines 268-304 Link Here
268
    private void updateGUI() {
276
    private void updateGUI() {
269
        // update project folder
277
        // update project folder
270
        folderValue.setText(getFolder().getPath());
278
        folderValue.setText(getFolder().getPath());
271
        
279
272
        if (isSuiteWizard() || isNetBeansOrgFolder()) {
280
        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
    }
281
    }
303
    
282
    
304
    /** Set <em>next</em> free project name. */
283
    /** Set <em>next</em> free project name. */
Lines 324-335 Link Here
324
        getData().setProjectFolder(folderValue.getText());
303
        getData().setProjectFolder(folderValue.getText());
325
        getData().setMainProject(mainProject.isSelected());
304
        getData().setMainProject(mainProject.isSelected());
326
        getData().setNetBeansOrg(isNetBeansOrgFolder());
305
        getData().setNetBeansOrg(isNetBeansOrgFolder());
327
        getData().setStandalone(isStandAlone());
306
        getData().setStandalone(typeChooserPanel.isStandAlone());
328
        getData().setSuiteRoot((String) moduleSuiteValue.getSelectedItem());
307
        getData().setSuiteRoot(typeChooserPanel.getSelectedSuite());
329
        if (isSuiteWizard() && suitePlatformValue.getSelectedItem() != null) {
308
        if (isSuiteWizard() && suitePlatformValue.getSelectedItem() != null) {
330
            getData().setPlatformID(((NbPlatform) suitePlatformValue.getSelectedItem()).getID());
309
            getData().setPlatformID(((NbPlatform) suitePlatformValue.getSelectedItem()).getID());
331
        } else if (platformValue.getSelectedItem() != null) {
310
        } else if (typeChooserPanel.getSelectedPlatform() != null) {
332
            getData().setPlatformID(((NbPlatform) platformValue.getSelectedItem()).getID());
311
            getData().setPlatformID(typeChooserPanel.getSelectedPlatform());
333
        }
312
        }
334
    }
313
    }
335
    
314
    
Lines 365-371 Link Here
365
            default:
344
            default:
366
                assert false : "Unknown wizard type = " + getData().getWizardType();
345
                assert false : "Unknown wizard type = " + getData().getWizardType();
367
        }
346
        }
368
        setProjectName(getMessage(bundlekey), counter);
347
        setProjectName(NbBundle.getMessage(BasicInfoVisualPanel.class, bundlekey), counter);
369
        nameValue.select(0, nameValue.getText().length());
348
        nameValue.select(0, nameValue.getText().length());
370
        nameUpdated = false;
349
        nameUpdated = false;
371
    }
350
    }
Lines 387-394 Link Here
387
                updateAndCheck();
366
                updateAndCheck();
388
            }
367
            }
389
        };
368
        };
390
        platformValue.addActionListener(plafAL);
391
        suitePlatformValue.addActionListener(plafAL);
369
        suitePlatformValue.addActionListener(plafAL);
370
        getSettings().addPropertyChangeListener(this);
392
    }
371
    }
393
    
372
    
394
    private File getFolder() {
373
    private File getFolder() {
Lines 401-432 Link Here
401
    }
380
    }
402
    
381
    
403
    private boolean isNetBeansOrgFolder() {
382
    private boolean isNetBeansOrgFolder() {
404
        return ModuleList.findNetBeansOrg(getFolder()) != null;
383
        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
    }
384
    }
431
    
385
    
432
    private void setLocation(String location, boolean silently) {
386
    private void setLocation(String location, boolean silently) {
Lines 451-470 Link Here
451
        }
405
        }
452
    }
406
    }
453
    
407
    
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
408
    /** This method is called from within the constructor to
463
     * initialize the form.
409
     * initialize the form.
464
     * WARNING: Do NOT modify this code. The content of this method is
410
     * WARNING: Do NOT modify this code. The content of this method is
465
     * always regenerated by the Form Editor.
411
     * always regenerated by the Form Editor.
466
     */
412
     */
467
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
413
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
468
    private void initComponents() {
414
    private void initComponents() {
469
        java.awt.GridBagConstraints gridBagConstraints;
415
        java.awt.GridBagConstraints gridBagConstraints;
470
416
Lines 483-506 Link Here
483
        manageSuitePlatform = new javax.swing.JButton();
429
        manageSuitePlatform = new javax.swing.JButton();
484
        separator3 = new javax.swing.JSeparator();
430
        separator3 = new javax.swing.JSeparator();
485
        mainProject = new javax.swing.JCheckBox();
431
        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();
432
        pnlThouShaltBeholdLayout = new javax.swing.JPanel();
433
        typeChooserPanelContainer = new javax.swing.JPanel();
497
434
498
        setLayout(new java.awt.GridBagLayout());
435
        setLayout(new java.awt.GridBagLayout());
499
436
500
        infoPanel.setLayout(new java.awt.GridBagLayout());
437
        infoPanel.setLayout(new java.awt.GridBagLayout());
501
438
502
        nameLbl.setLabelFor(nameValue);
439
        nameLbl.setLabelFor(nameValue);
503
        org.openide.awt.Mnemonics.setLocalizedText(nameLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectName"));
440
        org.openide.awt.Mnemonics.setLocalizedText(nameLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectName")); // NOI18N
504
        gridBagConstraints = new java.awt.GridBagConstraints();
441
        gridBagConstraints = new java.awt.GridBagConstraints();
505
        gridBagConstraints.gridx = 0;
442
        gridBagConstraints.gridx = 0;
506
        gridBagConstraints.gridy = 0;
443
        gridBagConstraints.gridy = 0;
Lines 509-515 Link Here
509
        infoPanel.add(nameLbl, gridBagConstraints);
446
        infoPanel.add(nameLbl, gridBagConstraints);
510
447
511
        locationLbl.setLabelFor(locationValue);
448
        locationLbl.setLabelFor(locationValue);
512
        org.openide.awt.Mnemonics.setLocalizedText(locationLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectLocation"));
449
        org.openide.awt.Mnemonics.setLocalizedText(locationLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectLocation")); // NOI18N
513
        gridBagConstraints = new java.awt.GridBagConstraints();
450
        gridBagConstraints = new java.awt.GridBagConstraints();
514
        gridBagConstraints.gridx = 0;
451
        gridBagConstraints.gridx = 0;
515
        gridBagConstraints.gridy = 1;
452
        gridBagConstraints.gridy = 1;
Lines 518-524 Link Here
518
        infoPanel.add(locationLbl, gridBagConstraints);
455
        infoPanel.add(locationLbl, gridBagConstraints);
519
456
520
        folderLbl.setLabelFor(folderValue);
457
        folderLbl.setLabelFor(folderValue);
521
        org.openide.awt.Mnemonics.setLocalizedText(folderLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectFolder"));
458
        org.openide.awt.Mnemonics.setLocalizedText(folderLbl, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_ProjectFolder")); // NOI18N
522
        gridBagConstraints = new java.awt.GridBagConstraints();
459
        gridBagConstraints = new java.awt.GridBagConstraints();
523
        gridBagConstraints.gridx = 0;
460
        gridBagConstraints.gridx = 0;
524
        gridBagConstraints.gridy = 2;
461
        gridBagConstraints.gridy = 2;
Lines 534-539 Link Here
534
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
471
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
535
        gridBagConstraints.weightx = 1.0;
472
        gridBagConstraints.weightx = 1.0;
536
        infoPanel.add(nameValue, gridBagConstraints);
473
        infoPanel.add(nameValue, gridBagConstraints);
474
        nameValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_NameValue")); // NOI18N
475
        nameValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_NameValue")); // NOI18N
537
476
538
        locationValue.setHorizontalAlignment(javax.swing.JTextField.LEFT);
477
        locationValue.setHorizontalAlignment(javax.swing.JTextField.LEFT);
539
        gridBagConstraints = new java.awt.GridBagConstraints();
478
        gridBagConstraints = new java.awt.GridBagConstraints();
Lines 543-561 Link Here
543
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
482
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
544
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
483
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
545
        infoPanel.add(locationValue, gridBagConstraints);
484
        infoPanel.add(locationValue, gridBagConstraints);
485
        locationValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_LocationValue")); // NOI18N
486
        locationValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_LocationValue")); // NOI18N
546
487
547
        org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_BrowseButton_o"));
488
        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() {
489
        browseButton.addActionListener(new java.awt.event.ActionListener() {
549
            public void actionPerformed(java.awt.event.ActionEvent evt) {
490
            public void actionPerformed(java.awt.event.ActionEvent evt) {
550
                browseLocation(evt);
491
                browseLocation(evt);
551
            }
492
            }
552
        });
493
        });
553
554
        gridBagConstraints = new java.awt.GridBagConstraints();
494
        gridBagConstraints = new java.awt.GridBagConstraints();
555
        gridBagConstraints.gridx = 2;
495
        gridBagConstraints.gridx = 2;
556
        gridBagConstraints.gridy = 1;
496
        gridBagConstraints.gridy = 1;
557
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
497
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
558
        infoPanel.add(browseButton, gridBagConstraints);
498
        infoPanel.add(browseButton, gridBagConstraints);
499
        browseButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_BrowseButton")); // NOI18N
500
        browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_BrowseButton")); // NOI18N
559
501
560
        gridBagConstraints = new java.awt.GridBagConstraints();
502
        gridBagConstraints = new java.awt.GridBagConstraints();
561
        gridBagConstraints.gridx = 1;
503
        gridBagConstraints.gridx = 1;
Lines 570-585 Link Here
570
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
512
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
571
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
513
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
572
        infoPanel.add(folderValue, gridBagConstraints);
514
        infoPanel.add(folderValue, gridBagConstraints);
515
        folderValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_FolderValue")); // NOI18N
516
        folderValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_FolderValue")); // NOI18N
573
517
574
        suitePlatform.setLabelFor(suitePlatformValue);
518
        suitePlatform.setLabelFor(suitePlatformValue);
575
        org.openide.awt.Mnemonics.setLocalizedText(suitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_NetBeansPlatform"));
519
        org.openide.awt.Mnemonics.setLocalizedText(suitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "LBL_NetBeansPlatform")); // NOI18N
576
        gridBagConstraints = new java.awt.GridBagConstraints();
520
        gridBagConstraints = new java.awt.GridBagConstraints();
577
        gridBagConstraints.gridx = 0;
521
        gridBagConstraints.gridx = 0;
578
        gridBagConstraints.gridy = 4;
522
        gridBagConstraints.gridy = 4;
579
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
523
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
580
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 12);
524
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 12);
581
        infoPanel.add(suitePlatform, gridBagConstraints);
525
        infoPanel.add(suitePlatform, gridBagConstraints);
582
583
        gridBagConstraints = new java.awt.GridBagConstraints();
526
        gridBagConstraints = new java.awt.GridBagConstraints();
584
        gridBagConstraints.gridx = 1;
527
        gridBagConstraints.gridx = 1;
585
        gridBagConstraints.gridy = 4;
528
        gridBagConstraints.gridy = 4;
Lines 588-601 Link Here
588
        gridBagConstraints.weightx = 1.0;
531
        gridBagConstraints.weightx = 1.0;
589
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
532
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
590
        infoPanel.add(suitePlatformValue, gridBagConstraints);
533
        infoPanel.add(suitePlatformValue, gridBagConstraints);
534
        suitePlatformValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_SuitePlatformValue")); // NOI18N
535
        suitePlatformValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_SuitePlatformValue")); // NOI18N
591
536
592
        org.openide.awt.Mnemonics.setLocalizedText(manageSuitePlatform, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_ManagePlatforms_g"));
537
        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() {
538
        manageSuitePlatform.addActionListener(new java.awt.event.ActionListener() {
594
            public void actionPerformed(java.awt.event.ActionEvent evt) {
539
            public void actionPerformed(java.awt.event.ActionEvent evt) {
595
                manageSuitePlatformActionPerformed(evt);
540
                manageSuitePlatformActionPerformed(evt);
596
            }
541
            }
597
        });
542
        });
598
599
        gridBagConstraints = new java.awt.GridBagConstraints();
543
        gridBagConstraints = new java.awt.GridBagConstraints();
600
        gridBagConstraints.gridx = 2;
544
        gridBagConstraints.gridx = 2;
601
        gridBagConstraints.gridy = 4;
545
        gridBagConstraints.gridy = 4;
Lines 603-608 Link Here
603
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
547
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
604
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
548
        gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0);
605
        infoPanel.add(manageSuitePlatform, gridBagConstraints);
549
        infoPanel.add(manageSuitePlatform, gridBagConstraints);
550
        manageSuitePlatform.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_ManageSuitePlatform")); // NOI18N
551
        manageSuitePlatform.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_ManageSuitePlatform")); // NOI18N
606
552
607
        gridBagConstraints = new java.awt.GridBagConstraints();
553
        gridBagConstraints = new java.awt.GridBagConstraints();
608
        gridBagConstraints.gridx = 0;
554
        gridBagConstraints.gridx = 0;
Lines 621-763 Link Here
621
        add(infoPanel, gridBagConstraints);
567
        add(infoPanel, gridBagConstraints);
622
568
623
        mainProject.setSelected(true);
569
        mainProject.setSelected(true);
624
        org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_SetAsMainProject"));
570
        org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "CTL_SetAsMainProject")); // NOI18N
625
        mainProject.addActionListener(new java.awt.event.ActionListener() {
571
        mainProject.addActionListener(new java.awt.event.ActionListener() {
626
            public void actionPerformed(java.awt.event.ActionEvent evt) {
572
            public void actionPerformed(java.awt.event.ActionEvent evt) {
627
                mainProjectActionPerformed(evt);
573
                mainProjectActionPerformed(evt);
628
            }
574
            }
629
        });
575
        });
630
631
        gridBagConstraints = new java.awt.GridBagConstraints();
576
        gridBagConstraints = new java.awt.GridBagConstraints();
632
        gridBagConstraints.gridx = 0;
577
        gridBagConstraints.gridx = 0;
633
        gridBagConstraints.gridy = 2;
578
        gridBagConstraints.gridy = 2;
634
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
579
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
635
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
580
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
636
        add(mainProject, gridBagConstraints);
581
        add(mainProject, gridBagConstraints);
637
582
        mainProject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_CTL_MainProject")); // NOI18N
638
        typeChooserPanel.setLayout(new java.awt.GridBagLayout());
583
        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
584
762
        gridBagConstraints = new java.awt.GridBagConstraints();
585
        gridBagConstraints = new java.awt.GridBagConstraints();
763
        gridBagConstraints.gridx = 0;
586
        gridBagConstraints.gridx = 0;
Lines 768-773 Link Here
768
        gridBagConstraints.weighty = 1.0;
591
        gridBagConstraints.weighty = 1.0;
769
        add(pnlThouShaltBeholdLayout, gridBagConstraints);
592
        add(pnlThouShaltBeholdLayout, gridBagConstraints);
770
593
594
        typeChooserPanelContainer.setLayout(new java.awt.BorderLayout());
595
        gridBagConstraints = new java.awt.GridBagConstraints();
596
        gridBagConstraints.gridx = 0;
597
        gridBagConstraints.gridy = 1;
598
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
599
        add(typeChooserPanelContainer, gridBagConstraints);
600
601
        getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_BasicInfoVisualPanel")); // NOI18N
602
        getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicInfoVisualPanel.class, "ACS_BasicInfoVisualPanel")); // NOI18N
771
    }// </editor-fold>//GEN-END:initComponents
603
    }// </editor-fold>//GEN-END:initComponents
772
    
604
    
773
    private void manageSuitePlatformActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageSuitePlatformActionPerformed
605
    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
609
    private void mainProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainProjectActionPerformed
778
        mainProjectTouched = true;
610
        mainProjectTouched = true;
779
    }//GEN-LAST:event_mainProjectActionPerformed
611
    }//GEN-LAST:event_mainProjectActionPerformed
780
    
612
        
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) {
613
    private void managePlatform(final JComboBox platformCombo) {
786
        NbPlatformCustomizer.showCustomizer();
614
        NbPlatformCustomizer.showCustomizer();
787
        platformCombo.setModel(new PlatformComponentFactory.NbPlatformListModel()); // refresh
615
        platformCombo.setModel(new PlatformComponentFactory.NbPlatformListModel()); // refresh
788
        platformCombo.requestFocus();
616
        platformCombo.requestFocus();
789
        updateAndCheck();
617
        updateAndCheck();
790
    }
618
    }
791
    
619
                    
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
620
    private void browseLocation(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLocation
848
        JFileChooser chooser = new JFileChooser(getLocationValue());
621
        JFileChooser chooser = new JFileChooser(getLocationValue());
849
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
622
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Lines 855-862 Link Here
855
    
628
    
856
    // Variables declaration - do not modify//GEN-BEGIN:variables
629
    // Variables declaration - do not modify//GEN-BEGIN:variables
857
    private javax.swing.JButton browseButton;
630
    private javax.swing.JButton browseButton;
858
    private javax.swing.JButton browseSuiteButton;
859
    private javax.swing.JLabel chooserFiller;
860
    private javax.swing.JLabel filler;
631
    private javax.swing.JLabel filler;
861
    private javax.swing.JLabel folderLbl;
632
    private javax.swing.JLabel folderLbl;
862
    private javax.swing.JTextField folderValue;
633
    private javax.swing.JTextField folderValue;
Lines 864-885 Link Here
864
    private javax.swing.JLabel locationLbl;
635
    private javax.swing.JLabel locationLbl;
865
    private javax.swing.JTextField locationValue;
636
    private javax.swing.JTextField locationValue;
866
    private javax.swing.JCheckBox mainProject;
637
    private javax.swing.JCheckBox mainProject;
867
    private javax.swing.JButton managePlatform;
868
    private javax.swing.JButton manageSuitePlatform;
638
    private javax.swing.JButton manageSuitePlatform;
869
    private javax.swing.JLabel moduleSuite;
870
    private javax.swing.JComboBox moduleSuiteValue;
871
    private javax.swing.ButtonGroup moduleTypeGroup;
639
    private javax.swing.ButtonGroup moduleTypeGroup;
872
    private javax.swing.JLabel nameLbl;
640
    private javax.swing.JLabel nameLbl;
873
    javax.swing.JTextField nameValue;
641
    javax.swing.JTextField nameValue;
874
    private javax.swing.JLabel platform;
875
    private javax.swing.JComboBox platformValue;
876
    private javax.swing.JPanel pnlThouShaltBeholdLayout;
642
    private javax.swing.JPanel pnlThouShaltBeholdLayout;
877
    private javax.swing.JSeparator separator3;
643
    private javax.swing.JSeparator separator3;
878
    private javax.swing.JRadioButton standAloneModule;
879
    private javax.swing.JRadioButton suiteComponent;
880
    private javax.swing.JLabel suitePlatform;
644
    private javax.swing.JLabel suitePlatform;
881
    private javax.swing.JComboBox suitePlatformValue;
645
    private javax.swing.JComboBox suitePlatformValue;
882
    private javax.swing.JPanel typeChooserPanel;
646
    private javax.swing.JPanel typeChooserPanelContainer;
883
    // End of variables declaration//GEN-END:variables
647
    // End of variables declaration//GEN-END:variables
884
    
648
    
649
    private TypeChooserPanelImpl typeChooserPanel;
885
}
650
}
(-)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 (+603 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.modules.apisupport.project.ui.wizard.spi.ModuleTypePanel;
58
import org.netbeans.spi.project.ui.support.ProjectChooser;
59
import org.openide.DialogDescriptor;
60
import org.openide.DialogDisplayer;
61
import org.openide.ErrorManager;
62
import org.openide.WizardDescriptor;
63
import org.openide.filesystems.FileUtil;
64
import org.openide.util.NbBundle;
65
66
/**
67
 *
68
 * @author  akorostelev
69
 */
70
public class TypeChooserPanelImpl  extends javax.swing.JPanel{
71
72
    private ButtonModel lastSelectedType;
73
    private static String lastSelectedSuite;
74
    private boolean moduleTypeGroupAttached = false;
75
    private WizardDescriptor settings;
76
    private Type wizardType;
77
    
78
    public TypeChooserPanelImpl(final WizardDescriptor settings) {
79
        this();
80
        this.settings = settings;
81
        attachModuleTypeGroup();
82
        storeInitialValuesToWD(getSettings());
83
        attachPropertyChangeListener(getSettings());
84
    }
85
86
    TypeChooserPanelImpl() {
87
        initComponents();
88
        init();
89
    }
90
    
91
    /** Creates new form TypeChooserPanel */
92
    TypeChooserPanelImpl(final WizardDescriptor settings, Type wizardType) {
93
        this();
94
        this.settings = settings;
95
        this.wizardType = wizardType;
96
        storeInitialValuesToWD(getSettings());
97
        attachPropertyChangeListener(getSettings());
98
        switch (wizardType) {
99
            case SUITE:
100
            case APPLICATION:
101
                detachModuleTypeGroup();
102
                break;
103
            case LIBRARY_MODULE:
104
                moduleSuite.setText(NbBundle.getMessage(
105
                        TypeChooserPanelImpl.class, "LBL_Add_to_Suite")); // NOI18N
106
                suiteComponent.setSelected(true);
107
                if (moduleSuiteValue.getItemCount() > 0) {
108
                    restoreSelectedSuite();
109
                }
110
                break;
111
            case MODULE:
112
            case SUITE_COMPONENT:
113
            default:
114
                if (moduleSuiteValue.getItemCount() > 0) {
115
                    restoreSelectedSuite();
116
                    suiteComponent.setSelected(true);
117
                }
118
        }
119
    }
120
    
121
    protected static JComboBox getDefaultSuitesComboBox(){
122
        return PlatformComponentFactory.getSuitesComboBox();
123
    }
124
    
125
    protected boolean isStandAlone() {
126
        return standAloneModule.isSelected();
127
    }
128
    
129
    protected boolean isSuiteComponent() {
130
        return suiteComponent.isSelected();
131
    }
132
    
133
    protected String getSelectedSuite() {
134
        return (String) moduleSuiteValue.getSelectedItem();
135
    }
136
    
137
    protected boolean isNetBeansOrgFolder() {
138
        File folder = ModuleTypePanelInner.getProjectFolder(getSettings());
139
        if (folder != null){
140
            return BasicInfoVisualPanel.isNetBeansOrgFolder(folder);
141
        }
142
        return false;
143
    }
144
    
145
    // TODO rename to platformID
146
    protected String getSelectedPlatform() {
147
        Object selected = platformValue.getSelectedItem();
148
        if (selected != null){
149
            return ((NbPlatform) platformValue.getSelectedItem()).getID();
150
        } else {
151
            return null;
152
        }
153
    }
154
    // todo rename to platform
155
    protected NbPlatform getSelectedNbPlatform() {
156
        Object selected = platformValue.getSelectedItem();
157
        if (selected != null){
158
            return (NbPlatform) platformValue.getSelectedItem();
159
        } else {
160
            return null;
161
        }
162
    }
163
    
164
    protected void setComponentsVisibility(boolean isSuiteComponentWizard, 
165
            boolean isLibraryWizard)
166
    {
167
        suiteComponent.setVisible(!isLibraryWizard);
168
        platform.setVisible(!isLibraryWizard);
169
        platformValue.setVisible(!isLibraryWizard);
170
        managePlatform.setVisible(!isLibraryWizard);
171
        standAloneModule.setVisible(!isLibraryWizard);
172
        
173
        standAloneModule.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
174
        platform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
175
        platformValue.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
176
        managePlatform.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
177
        suiteComponent.setVisible(!isSuiteComponentWizard && !isLibraryWizard);
178
        
179
    }
180
    
181
    private void updateEnabled(){
182
        boolean isNetBeansOrg = isNetBeansOrgFolder();
183
        standAloneModule.setEnabled(!isNetBeansOrg);
184
        suiteComponent.setEnabled(!isNetBeansOrg);
185
        
186
        boolean standalone = isStandAlone();
187
        boolean suiteModuleSelected = isSuiteComponent();
188
        platform.setEnabled(standalone);
189
        platformValue.setEnabled(standalone);
190
        managePlatform.setEnabled(standalone);
191
        moduleSuite.setEnabled(suiteModuleSelected);
192
        moduleSuiteValue.setEnabled(suiteModuleSelected && !isOneSuiteDedicatedMode());
193
        browseSuiteButton.setEnabled(suiteModuleSelected && !isOneSuiteDedicatedMode());
194
    }
195
    
196
    private void projectFolderIsUpdated() {
197
        
198
        if (isSuiteWizard(getWizardType()) || isNetBeansOrgFolder()) {
199
            detachModuleTypeGroup();
200
        } else {
201
            attachModuleTypeGroup();
202
        }
203
        updateEnabled();
204
        ModuleTypePanelInner.setIsNetBeansOrg(getSettings(), isNetBeansOrgFolder());
205
    }
206
207
    private void storeInitialValuesToWD(WizardDescriptor settings){
208
        ModuleTypePanelInner.setIsNetBeansOrg(settings, isNetBeansOrgFolder());
209
        ModuleTypePanelInner.setIsStandaloneOrSuiteComponent(settings, isStandAlone());
210
        ModuleTypePanelInner.setSuiteRoot(settings, getSelectedSuite());
211
        ModuleTypePanelInner.setActivePlatformId(settings, getSelectedPlatform());
212
        ModuleTypePanelInner.setActiveNbPlatform(settings, getSelectedNbPlatform());
213
    }
214
215
    private void attachPropertyChangeListener(WizardDescriptor settings){
216
        settings.addPropertyChangeListener(new ProjectFolderChangeListener());
217
    }
218
        
219
    private void detachModuleTypeGroup() {
220
        if (moduleTypeGroupAttached) {
221
            lastSelectedType = moduleTypeGroup.getSelection();
222
            moduleTypeGroup.remove(standAloneModule);
223
            moduleTypeGroup.remove(suiteComponent);
224
            standAloneModule.setSelected(false);
225
            suiteComponent.setSelected(false);
226
            ModuleTypePanelInner.setIsStandaloneOrSuiteComponent(getSettings(), null);
227
            moduleTypeGroupAttached = false;
228
        }
229
    }
230
    
231
    /**
232
     * Adds radiobuttons to ButtonGroup and sets selection.
233
     */
234
    protected void attachModuleTypeGroup() {
235
        if (!moduleTypeGroupAttached) {
236
            moduleTypeGroup.add(standAloneModule);
237
            moduleTypeGroup.add(suiteComponent);
238
            if (isLibraryWizard(getWizardType())) {
239
                suiteComponent.setSelected(true);
240
            } else {
241
                moduleTypeGroup.setSelected(lastSelectedType, true);
242
            }
243
            moduleTypeGroupAttached = true;
244
        }
245
    }
246
    
247
    private void init(){
248
        BasicInfoVisualPanel.initPlatformCombo(platformValue);
249
        if (moduleSuiteValue.getItemCount() > 0) {
250
            restoreSelectedSuite();
251
            suiteComponent.setSelected(true);
252
        }
253
    }
254
    
255
    private void restoreSelectedSuite() {
256
        String preferredSuiteDir  = getPreferredSuiteDir();
257
        if (preferredSuiteDir != null) {
258
            lastSelectedSuite = preferredSuiteDir;
259
        }
260
        if (lastSelectedSuite != null) {
261
            int max = moduleSuiteValue.getModel().getSize();
262
            for (int i=0; i < max; i++) {
263
                if (lastSelectedSuite.equals(moduleSuiteValue.getModel().getElementAt(i))) {
264
                    moduleSuiteValue.setSelectedItem(lastSelectedSuite);
265
                    break;
266
                }
267
            }
268
        }
269
    }
270
    
271
    private String getPreferredSuiteDir() {
272
        if (getSettings() != null){
273
            return (String) getSettings().getProperty(NewNbModuleWizardIterator.PREFERRED_SUITE_DIR);
274
        }
275
        return null;
276
    }
277
    
278
    private boolean isOneSuiteDedicatedMode() {
279
        Boolean b = false;
280
        if (getSettings() != null){
281
            b = (Boolean) getSettings().getProperty(
282
                    NewNbModuleWizardIterator.ONE_SUITE_DEDICATED_MODE);
283
        }
284
        return b != null ? b.booleanValue() : false;
285
    }
286
    
287
    /** This method is called from within the constructor to
288
     * initialize the form.
289
     * WARNING: Do NOT modify this code. The content of this method is
290
     * always regenerated by the Form Editor.
291
     */
292
    @SuppressWarnings("unchecked")
293
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
294
    private void initComponents() {
295
        java.awt.GridBagConstraints gridBagConstraints;
296
297
        moduleTypeGroup = new javax.swing.ButtonGroup();
298
        typeChooserPanel = new javax.swing.JPanel();
299
        standAloneModule = new javax.swing.JRadioButton();
300
        platform = new javax.swing.JLabel();
301
        platformValue = PlatformComponentFactory.getNbPlatformsComboxBox();
302
        managePlatform = new javax.swing.JButton();
303
        suiteComponent = new javax.swing.JRadioButton();
304
        moduleSuite = new javax.swing.JLabel();
305
        moduleSuiteValue = getDefaultSuitesComboBox();
306
        browseSuiteButton = new javax.swing.JButton();
307
        chooserFiller = new javax.swing.JLabel();
308
309
        setLayout(new java.awt.BorderLayout());
310
311
        typeChooserPanel.setLayout(new java.awt.GridBagLayout());
312
313
        moduleTypeGroup.add(standAloneModule);
314
        standAloneModule.setSelected(true);
315
        org.openide.awt.Mnemonics.setLocalizedText(standAloneModule, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_StandaloneModule")); // NOI18N
316
        standAloneModule.addActionListener(new java.awt.event.ActionListener() {
317
            public void actionPerformed(java.awt.event.ActionEvent evt) {
318
                standAloneModuleTypeChanged(evt);
319
            }
320
        });
321
        gridBagConstraints = new java.awt.GridBagConstraints();
322
        gridBagConstraints.gridx = 0;
323
        gridBagConstraints.gridy = 0;
324
        gridBagConstraints.gridwidth = 3;
325
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
326
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
327
        typeChooserPanel.add(standAloneModule, gridBagConstraints);
328
        standAloneModule.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_StandAloneModule")); // NOI18N
329
        standAloneModule.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_StandAloneModule")); // NOI18N
330
331
        platform.setLabelFor(platformValue);
332
        org.openide.awt.Mnemonics.setLocalizedText(platform, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "LBL_NetBeansPlatform")); // NOI18N
333
        gridBagConstraints = new java.awt.GridBagConstraints();
334
        gridBagConstraints.gridx = 0;
335
        gridBagConstraints.gridy = 1;
336
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
337
        gridBagConstraints.insets = new java.awt.Insets(0, 18, 0, 12);
338
        typeChooserPanel.add(platform, gridBagConstraints);
339
340
        platformValue.addActionListener(new java.awt.event.ActionListener() {
341
            public void actionPerformed(java.awt.event.ActionEvent evt) {
342
                platformChosen(evt);
343
            }
344
        });
345
        gridBagConstraints = new java.awt.GridBagConstraints();
346
        gridBagConstraints.gridx = 1;
347
        gridBagConstraints.gridy = 1;
348
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
349
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
350
        gridBagConstraints.weightx = 1.0;
351
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
352
        typeChooserPanel.add(platformValue, gridBagConstraints);
353
        platformValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_PlatformValue")); // NOI18N
354
        platformValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_PlatformValue")); // NOI18N
355
356
        org.openide.awt.Mnemonics.setLocalizedText(managePlatform, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_ManagePlatforms_g")); // NOI18N
357
        managePlatform.addActionListener(new java.awt.event.ActionListener() {
358
            public void actionPerformed(java.awt.event.ActionEvent evt) {
359
                managePlatformActionPerformed(evt);
360
            }
361
        });
362
        gridBagConstraints = new java.awt.GridBagConstraints();
363
        gridBagConstraints.gridx = 2;
364
        gridBagConstraints.gridy = 1;
365
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
366
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
367
        typeChooserPanel.add(managePlatform, gridBagConstraints);
368
        managePlatform.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ManagePlatform")); // NOI18N
369
        managePlatform.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ManagePlatform")); // NOI18N
370
371
        moduleTypeGroup.add(suiteComponent);
372
        org.openide.awt.Mnemonics.setLocalizedText(suiteComponent, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_AddToModuleSuite")); // NOI18N
373
        suiteComponent.addActionListener(new java.awt.event.ActionListener() {
374
            public void actionPerformed(java.awt.event.ActionEvent evt) {
375
                suiteComponentTypeChanged(evt);
376
            }
377
        });
378
        gridBagConstraints = new java.awt.GridBagConstraints();
379
        gridBagConstraints.gridx = 0;
380
        gridBagConstraints.gridy = 2;
381
        gridBagConstraints.gridwidth = 3;
382
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
383
        gridBagConstraints.insets = new java.awt.Insets(18, 0, 0, 0);
384
        typeChooserPanel.add(suiteComponent, gridBagConstraints);
385
        suiteComponent.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_SuiteModule")); // NOI18N
386
        suiteComponent.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_SuiteModule")); // NOI18N
387
388
        moduleSuite.setLabelFor(moduleSuiteValue);
389
        org.openide.awt.Mnemonics.setLocalizedText(moduleSuite, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "LBL_ModuleSuite")); // NOI18N
390
        gridBagConstraints = new java.awt.GridBagConstraints();
391
        gridBagConstraints.gridx = 0;
392
        gridBagConstraints.gridy = 3;
393
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
394
        gridBagConstraints.insets = new java.awt.Insets(6, 18, 0, 12);
395
        typeChooserPanel.add(moduleSuite, gridBagConstraints);
396
397
        moduleSuiteValue.addActionListener(new java.awt.event.ActionListener() {
398
            public void actionPerformed(java.awt.event.ActionEvent evt) {
399
                moduleSuiteChosen(evt);
400
            }
401
        });
402
        gridBagConstraints = new java.awt.GridBagConstraints();
403
        gridBagConstraints.gridx = 1;
404
        gridBagConstraints.gridy = 3;
405
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
406
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
407
        gridBagConstraints.weightx = 1.0;
408
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 12);
409
        typeChooserPanel.add(moduleSuiteValue, gridBagConstraints);
410
        moduleSuiteValue.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ModuleSuiteValue")); // NOI18N
411
        moduleSuiteValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_ModuleSuiteValue")); // NOI18N
412
413
        org.openide.awt.Mnemonics.setLocalizedText(browseSuiteButton, org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "CTL_BrowseButton_w")); // NOI18N
414
        browseSuiteButton.addActionListener(new java.awt.event.ActionListener() {
415
            public void actionPerformed(java.awt.event.ActionEvent evt) {
416
                browseModuleSuite(evt);
417
            }
418
        });
419
        gridBagConstraints = new java.awt.GridBagConstraints();
420
        gridBagConstraints.gridx = 2;
421
        gridBagConstraints.gridy = 3;
422
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
423
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
424
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
425
        typeChooserPanel.add(browseSuiteButton, gridBagConstraints);
426
        browseSuiteButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_BrowseSuiteButton")); // NOI18N
427
        browseSuiteButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TypeChooserPanelImpl.class, "ACS_CTL_BrowseSuiteButton")); // NOI18N
428
429
        gridBagConstraints = new java.awt.GridBagConstraints();
430
        gridBagConstraints.gridx = 0;
431
        gridBagConstraints.gridy = 4;
432
        gridBagConstraints.weighty = 1.0;
433
        typeChooserPanel.add(chooserFiller, gridBagConstraints);
434
435
        add(typeChooserPanel, java.awt.BorderLayout.CENTER);
436
    }// </editor-fold>//GEN-END:initComponents
437
438
private void standAloneModuleTypeChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_standAloneModuleTypeChanged
439
    ModuleTypePanelInner.setIsStandaloneOrSuiteComponent(getSettings(), isStandAlone());
440
    updateEnabled();
441
}//GEN-LAST:event_standAloneModuleTypeChanged
442
443
private void platformChosen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_platformChosen
444
    ModuleTypePanelInner.setActivePlatformId(getSettings(), getSelectedPlatform());
445
    ModuleTypePanelInner.setActiveNbPlatform(getSettings(), getSelectedNbPlatform());
446
    updateEnabled();
447
}//GEN-LAST:event_platformChosen
448
449
private void managePlatformActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_managePlatformActionPerformed
450
    managePlatform(platformValue);
451
    ModuleTypePanelInner.setActivePlatformId(getSettings(), getSelectedPlatform());
452
    ModuleTypePanelInner.setActiveNbPlatform(getSettings(), getSelectedNbPlatform());
453
    updateEnabled();
454
}//GEN-LAST:event_managePlatformActionPerformed
455
456
    private void managePlatform(final JComboBox platformCombo) {
457
        NbPlatformCustomizer.showCustomizer();
458
        platformCombo.setModel(new PlatformComponentFactory.NbPlatformListModel()); // refresh
459
460
        platformCombo.requestFocus();
461
    }
462
463
private void suiteComponentTypeChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_suiteComponentTypeChanged
464
    ModuleTypePanelInner.setIsStandaloneOrSuiteComponent(getSettings(), isStandAlone());
465
    updateEnabled();
466
}//GEN-LAST:event_suiteComponentTypeChanged
467
468
private void moduleSuiteChosen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleSuiteChosen
469
    String suite = (String) moduleSuiteValue.getSelectedItem();
470
    lastSelectedSuite = suite;
471
    ModuleTypePanelInner.setSuiteRoot(getSettings(), getSelectedSuite());
472
    updateEnabled();
473
}//GEN-LAST:event_moduleSuiteChosen
474
475
private void browseModuleSuite(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseModuleSuite
476
JFileChooser chooser = ProjectChooser.projectChooser();
477
        int option = chooser.showOpenDialog(this);
478
        if (option == JFileChooser.APPROVE_OPTION) {
479
            File projectDir = chooser.getSelectedFile();
480
            UIUtil.setProjectChooserDirParent(projectDir);
481
            try {
482
                Project suite = ProjectManager.getDefault().findProject(
483
                        FileUtil.toFileObject(projectDir));
484
                if (suite != null) {
485
                    String suiteDir = SuiteUtils.getSuiteDirectoryPath(suite);
486
                    if (suiteDir != null) {
487
                        // register for this session
488
                        PlatformComponentFactory.addUserSuite(suiteDir);
489
                        // add to current combobox
490
                        moduleSuiteValue.addItem(suiteDir);
491
                        moduleSuiteValue.setSelectedItem(suiteDir);
492
                    } else {
493
                        DialogDisplayer.getDefault().notify(new DialogDescriptor.Message(
494
                                NbBundle.getMessage(BasicInfoVisualPanel.class, "MSG_NotRegularSuite",
495
                                ProjectUtils.getInformation(suite).getDisplayName())));
496
                    }
497
                }
498
            } catch (IOException e) {
499
                ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
500
            }
501
        }
502
}//GEN-LAST:event_browseModuleSuite
503
504
505
    // Variables declaration - do not modify//GEN-BEGIN:variables
506
    private javax.swing.JButton browseSuiteButton;
507
    private javax.swing.JLabel chooserFiller;
508
    private javax.swing.JButton managePlatform;
509
    private javax.swing.JLabel moduleSuite;
510
    private javax.swing.JComboBox moduleSuiteValue;
511
    private javax.swing.ButtonGroup moduleTypeGroup;
512
    private javax.swing.JLabel platform;
513
    private javax.swing.JComboBox platformValue;
514
    private javax.swing.JRadioButton standAloneModule;
515
    private javax.swing.JRadioButton suiteComponent;
516
    private javax.swing.JPanel typeChooserPanel;
517
    // End of variables declaration//GEN-END:variables
518
519
    
520
    
521
    protected WizardDescriptor getSettings(){
522
        return settings;
523
    }
524
    
525
    private Type getWizardType(){
526
        return this.wizardType;
527
    }
528
529
    private static boolean isSuiteWizard(Type type) {
530
        return type != null 
531
            ? NewNbModuleWizardIterator.isSuiteWizard(type)
532
            : false;
533
    }
534
535
    private static boolean isLibraryWizard(Type type) {
536
        return type != null 
537
            ? NewNbModuleWizardIterator.isLibraryWizard(type)
538
            : false;
539
    }
540
541
    private class ProjectFolderChangeListener extends ModuleTypePanelInner
542
            implements PropertyChangeListener 
543
    {
544
545
        public void propertyChange(PropertyChangeEvent evt) {
546
            String name = evt.getPropertyName();
547
548
            if (ModuleTypePanel.PROJECT_FOLDER.equals(name)) {
549
                projectFolderIsUpdated();
550
            }
551
        }
552
    }
553
    
554
    /**
555
     * is used to have access to propected attributes of ModuleTypePanel
556
     */
557
    private static class ModuleTypePanelInner extends ModuleTypePanel {
558
        protected static void setIsStandaloneOrSuiteComponent(
559
                WizardDescriptor settings, Boolean value)
560
        {
561
            if (settings != null){
562
                settings.putProperty(IS_STANDALONE_OR_SUITE_COMPONENT, value);
563
            }
564
        }
565
        
566
        protected static void setIsNetBeansOrg( WizardDescriptor settings, Boolean value) {
567
            if (settings != null){
568
                settings.putProperty(IS_NETBEANS_ORG, value);
569
            }
570
        }
571
        
572
        protected static void setActivePlatformId( WizardDescriptor settings, String value) {
573
            if (settings != null){
574
                settings.putProperty(ACTIVE_PLATFORM_ID, value);
575
            }
576
        }
577
        
578
        protected static void setActiveNbPlatform( WizardDescriptor settings, NbPlatform value) {
579
            if (settings != null){
580
                settings.putProperty(ACTIVE_NB_PLATFORM, value);
581
            }
582
        }
583
        
584
        protected static void setSuiteRoot( WizardDescriptor settings, String value) {
585
            if (settings != null){
586
                settings.putProperty(SUITE_ROOT, value);
587
            }
588
        }
589
        
590
        protected static File getProjectFolder( WizardDescriptor settings) {
591
            if (settings != null) {
592
                Object value = settings.getProperty(PROJECT_FOLDER);
593
                if (value != null && value instanceof File) {
594
                    return (File) value;
595
                }
596
            }
597
            return null;
598
        }
599
        
600
        
601
    }
602
603
}
(-)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 (+226 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.io.File;
42
import javax.swing.JComponent;
43
import org.netbeans.modules.apisupport.project.ui.wizard.TypeChooserPanelImpl;
44
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
45
import org.openide.WizardDescriptor;
46
import org.openide.util.NbBundle;
47
48
/**
49
 * Interface of UI panel for embedding into the First step 
50
 * of NetBeans module project wizard.
51
 * Panel contains UI to select
52
 * <ul>
53
 *  <li>NetBeans Platform (for standalone modules)</li>
54
 *  <li>Module Suite (for suite modules)</li>
55
 * </ul>
56
 * 
57
 * @author akorostelev
58
 */
59
public class ModuleTypePanel{
60
61
    /** 
62
     * Key for module type property.
63
     * key for Boolean value. use 
64
     */
65
    public final static String IS_STANDALONE_OR_SUITE_COMPONENT 
66
                                                = "tc_isStandaloneOrSuiteComp"; // NOI18N
67
68
    /** 
69
     * Suite root directory.
70
     * key for String value. 
71
     */
72
    public final static String SUITE_ROOT       = "tc_suiteRoot";               // NOI18N
73
74
    /** 
75
     * Active platform ID value to be used as value 
76
     * for nbplatform.active property in platform.properties file.
77
     * key for String value. 
78
     */
79
    public final static String ACTIVE_PLATFORM_ID  = "tc_activePlatform_id";          // NOI18N
80
81
    /** 
82
     * Active platform Object. 
83
     * key for org.netbeans.modules.apisupport.project.universe.NbPlatform value. 
84
     */
85
    protected final static String ACTIVE_NB_PLATFORM  = "tc_activeNBPlatform";  // NOI18N
86
    
87
    /** 
88
     * true if project is created in NetBeans sources.
89
     * key for Boolean value. 
90
     */
91
    protected final static String IS_NETBEANS_ORG = "isNetBeansOrg";            // NOI18N
92
93
    /** 
94
     * Is used to provide project's folder to TypeChooserPanel before
95
     * updateUI(WizardDescriptor) invocation. Is used by TypeChooserPanel
96
     * implementation to decide whether specified forder 
97
     * is in NetBeans.org repository.
98
     * key for File value. 
99
     */
100
    protected final static String PROJECT_FOLDER = "tc_projectFolderForTypeChooser"; // NOI18N
101
102
103
    /**
104
     * creates Panel's UI Component.
105
     * @param wizard Wizard descriptor to be used for getting property changge updates from Component.
106
     * @return JComponent Panel object
107
     */
108
    public static JComponent createComponent(WizardDescriptor wizard) {
109
        return (JComponent) new TypeChooserPanelImpl(wizard);
110
    }
111
112
    /**
113
     * validates panel. Error messages should be added to provided settings 
114
     * by setting WizardDescriptor.PROP_ERROR_MESSAGE property value:
115
     * <pre>
116
     * settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, message); 
117
     * </pre>
118
     * @param settings 
119
     * @return true if panel is valid. false otherwise.
120
     */
121
    public static boolean validate(WizardDescriptor settings) {
122
        if (isSuiteComponent(settings) && getSuiteRoot(settings) == null) {
123
            setErrorMessage(settings, NbBundle.getMessage(
124
                    ModuleTypePanel.class, "MSG_ChooseRegularSuite"));// NOI18N
125
            return false;
126
        } else if (isStandalone(settings) &&
127
                (getActiveNbPlatform(settings) == null || !(getActiveNbPlatform(settings)).isValid())) {
128
            setErrorMessage(settings, NbBundle.getMessage(
129
                    ModuleTypePanel.class, "MSG_ChosenPlatformIsInvalid"));// NOI18N
130
            return false;
131
        }
132
        return true;
133
    }
134
135
    /**
136
     * Notifies panel that project folder is changed 
137
     * and panel UI should be updated.
138
     * @param settings Wizard descriptor 
139
     * @param folder new Project folder value
140
     */
141
    public static void setProjectFolder(WizardDescriptor settings, File value) {
142
        settings.putProperty(PROJECT_FOLDER, value);
143
    }
144
        
145
    /**
146
     * Checks in Wizard Descriptor properties if "Add To Module Suite" was selected 
147
     * on Component created using createComponent(WizardDescriptor).
148
     * @param wizard Wizard descriptor 
149
     * @return true if "Add To Module Suite" radiobutton was selected. false if not. 
150
     */
151
    public static boolean isSuiteComponent(WizardDescriptor wizard){
152
        Object value = wizard.getProperty(IS_STANDALONE_OR_SUITE_COMPONENT);
153
        return !extractBoolean(value, true);
154
    }
155
    
156
    /**
157
     * Checks in Wizard Descriptor properties if "Standalone Module" was selected 
158
     * on Component created using createComponent(WizardDescriptor).
159
     * @param wizard Wizard descriptor 
160
     * @return true if "Standalone Module" radiobutton was selected. false if not. 
161
     */
162
    public static boolean isStandalone(WizardDescriptor wizard){
163
        Object value = wizard.getProperty(IS_STANDALONE_OR_SUITE_COMPONENT);
164
        return extractBoolean(value, false);
165
    }
166
    
167
    /**
168
     * Returns true if Module with project folder set by setProjectFolder(WizardDescriptor, File)
169
     * is NetBeans sourcees root
170
     * @param wizard Wizard descriptor 
171
     * @return true if specified Project folder is NetBeans sourcees root
172
     */
173
    public static boolean isNetBeansOrg(WizardDescriptor wizard){
174
        Object value = wizard.getProperty(IS_NETBEANS_ORG);
175
        return extractBoolean(value, false);
176
    }
177
    
178
    /**
179
     * Returns suite root directory stored in wizard descriptor by 
180
     * Component created using createComponent(WizardDescriptor).
181
     * @param wizard Wizard descriptor 
182
     * @return suite root directory
183
     */
184
    public static String getSuiteRoot(WizardDescriptor wizard){
185
        Object value = wizard.getProperty(SUITE_ROOT);
186
        return extractString(value, null);
187
    }
188
    
189
    /**
190
     * Returns platform id stored in wizard descriptor by 
191
     * Component created using createComponent(WizardDescriptor).
192
     * @param wizard Wizard descriptor 
193
     * @return platform id
194
     */
195
    public static String getActivePlatformId(WizardDescriptor wizard){
196
        Object value = wizard.getProperty(ACTIVE_PLATFORM_ID);
197
        return extractString(value, null);
198
    }
199
    
200
    private static NbPlatform getActiveNbPlatform(WizardDescriptor wizard){
201
        Object value = wizard.getProperty(ACTIVE_NB_PLATFORM);
202
        if (value != null && value instanceof NbPlatform){
203
            return (NbPlatform)value;
204
        }
205
        return null;
206
    }
207
    
208
    private static boolean extractBoolean(Object value, boolean defaultValue){
209
        if (value != null && value instanceof Boolean){
210
            return (Boolean)value;
211
        }
212
        return defaultValue;
213
    }
214
    
215
    private static String extractString(Object value, String defaultValue){
216
        if (value != null && value instanceof String){
217
            return (String)value;
218
        }
219
        return defaultValue;
220
    }
221
    
222
    private static void setErrorMessage(WizardDescriptor settings, String message) {
223
        settings.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, message); 
224
    }
225
226
}
(-)15806e5514ac (+151 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.io.File;
43
import javax.swing.JComponent;
44
import org.netbeans.modules.apisupport.project.TestBase;
45
import org.netbeans.modules.apisupport.project.ui.wizard.TypeChooserPanelImpl;
46
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
47
import org.openide.WizardDescriptor;
48
import org.openide.util.test.MockPropertyChangeListener;
49
50
/**
51
 *
52
 * @author avk
53
 */
54
public class ModuleTypePanelCreatorTest extends TestBase {
55
56
    public ModuleTypePanelCreatorTest(String testName) {
57
        super(testName);
58
    }
59
60
    /**
61
     * Test of create method, of class ModuleTypePanel.
62
     */
63
    public void testCreate() {
64
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
65
        JComponent result = ModuleTypePanel.createComponent(wizardDescriptor);
66
        // panel is created
67
        assertNotNull(result);
68
        // expected panel implementation is returned
69
        assertTrue(result instanceof TypeChooserPanelImpl);
70
    }
71
72
    public void testPropertyChangeNotifications() {
73
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
74
        MockPropertyChangeListener l = new MockPropertyChangeListener();
75
        wizardDescriptor.addPropertyChangeListener(l);
76
        
77
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
78
        // test that changes notifications are received
79
        ModuleTypePanel.setProjectFolder(wizardDescriptor, new File(""));
80
        
81
        l.assertEvents(ModuleTypePanel.IS_NETBEANS_ORG, 
82
                ModuleTypePanel.IS_STANDALONE_OR_SUITE_COMPONENT,
83
                ModuleTypePanel.SUITE_ROOT,
84
                ModuleTypePanel.ACTIVE_PLATFORM_ID,
85
                ModuleTypePanel.ACTIVE_NB_PLATFORM,
86
                ModuleTypePanel.PROJECT_FOLDER);
87
    }
88
    
89
    public void testPanelDisabledForNbOrg(){
90
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
91
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
92
93
        ModuleTypePanel.setProjectFolder(wizardDescriptor, 
94
                new File(nbRootFile(), "testProject"));
95
        
96
        assertTrue("project is in Nb Root", 
97
                ModuleTypePanel.isNetBeansOrg(wizardDescriptor));
98
        assertFalse("standalone radio buttyon is deselected",
99
                ModuleTypePanel.isStandalone(wizardDescriptor));
100
        assertFalse("suite component radio buttyon is deselected",
101
                ModuleTypePanel.isSuiteComponent(wizardDescriptor));
102
    }
103
104
    public void testPanelValuesForStandaloneModule(){
105
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
106
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
107
108
        ModuleTypePanel.setProjectFolder(wizardDescriptor, new File(""));
109
        
110
        assertFalse("project is NOT in Nb Root", 
111
                ModuleTypePanel.isNetBeansOrg(wizardDescriptor));
112
        assertTrue("standalone radios is selected",
113
                ModuleTypePanel.isStandalone(wizardDescriptor));
114
        assertNotNull("platrorm is selected",
115
                ModuleTypePanel.getActivePlatformId(wizardDescriptor));
116
        assertNotNull("platrorm is selected(test NbPlatform value)",
117
                (NbPlatform)wizardDescriptor.getProperty(ModuleTypePanel.ACTIVE_NB_PLATFORM));
118
    }
119
120
    public void testIsNetBeansOrgProperty() {
121
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
122
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
123
124
        File folder = new File("");
125
        Boolean isNbOrg = isFolderNbRoot(wizardDescriptor, folder);
126
        assertNotNull(isNbOrg);
127
        assertFalse(folder.getAbsolutePath() + " folder is NOT in NetBeans Root", isNbOrg);
128
        
129
        folder = new File(nbRootFile(), "testProject");//NOI18N
130
        isNbOrg = isFolderNbRoot(wizardDescriptor, folder );
131
        assertNotNull(isNbOrg);
132
        assertTrue(folder.getAbsolutePath() + " folder is in NetBeans Root", isNbOrg);
133
        
134
    }
135
    
136
    private Boolean isFolderNbRoot(WizardDescriptor wizardDescriptor, File folder){
137
        ModuleTypePanel.setProjectFolder(wizardDescriptor, folder);
138
        return ModuleTypePanel.isNetBeansOrg(wizardDescriptor);
139
    }
140
    
141
    public void testValidate(){
142
        WizardDescriptor wizardDescriptor = new WizardDescriptor() {};
143
        JComponent typeChooserPanel = ModuleTypePanel.createComponent(wizardDescriptor);
144
        // test default state
145
        ModuleTypePanel.validate(wizardDescriptor);
146
        assertNull("No error messages", 
147
                wizardDescriptor.getProperty(WizardDescriptor.PROP_ERROR_MESSAGE));
148
        
149
    }
150
    
151
}

Return to bug 144060