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

Return to bug 144060