Skip to content

Commit a5b05c9

Browse files
committed
Improvement for Child Theme Name
- Change child theme name to child directory name - Add child theme name text field
1 parent 7e8a9ac commit a5b05c9

4 files changed

Lines changed: 92 additions & 45 deletions

File tree

src/org/netbeans/modules/php/wordpress/ui/actions/CreateChildThemeAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void createChildTheme(FileObject themesDirectory) throws IOException, Da
161161
return;
162162
}
163163
// create child theme directory and style.css
164-
FileObject childThemeDirectory = themesDirectory.createFolder(getPanel().getChildThemeName());
164+
FileObject childThemeDirectory = themesDirectory.createFolder(getPanel().getChildDirectoryName());
165165
if (childThemeDirectory == null) {
166166
LOGGER.log(Level.WARNING, Bundle.CreateChildThemeAction_childFolder_error());
167167
return;
@@ -198,7 +198,7 @@ public void stateChanged(ChangeEvent e) {
198198
if (descriptor == null || panel == null) {
199199
return;
200200
}
201-
String childThemeName = getPanel().getChildThemeName();
201+
String childThemeName = getPanel().getChildDirectoryName();
202202
WordPressDirectoryNameValidator validator = new WordPressDirectoryNameValidator();
203203
ValidationResult result = validator.validateName(childThemeName)
204204
.validateExistingName(childThemeName, themes)

src/org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ CreateThemePanel.themeNameTextField.text=
3636
NewProjectConfigurationPanel.useWpCliRadioButton.text=Use wp-cli
3737
CreatePermalinkHtaccessPanel.messageLabel.text=MESSAGE
3838
CreateChildThemePanel.parentThemeLabel.text=Parent Theme:
39-
CreateChildThemePanel.childThemeNameLabel.text=Child Theme Name:
40-
CreateChildThemePanel.childThemeNameTextField.text=
4139
CreateChildThemePanel.errorLabel.text=ERROR
4240
CreateChildThemePanel.childThemeUriLabel.text=Child Theme URI:
4341
CreateChildThemePanel.descriptionLabel.text=Description:
@@ -53,3 +51,7 @@ CreateChildThemePanel.tagsTextField.text=
5351
CreateChildThemePanel.textDomainTextField.text=
5452
CreateChildThemePanel.authorUriLabel.text=Author URI:
5553
CreateChildThemePanel.authorUriTextField.text=
54+
CreateChildThemePanel.childDirectoryNameLabel.text=Child Directory Name:
55+
CreateChildThemePanel.childDirectoryNameTextField.text=
56+
CreateChildThemePanel.childThemeNameLabel.text=Child Theme Name:
57+
CreateChildThemePanel.childThemeNameTextField.text=

src/org/netbeans/modules/php/wordpress/ui/wizards/CreateChildThemePanel.form

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,45 @@
2121
<Group type="103" groupAlignment="0" attributes="0">
2222
<Group type="102" alignment="0" attributes="0">
2323
<Group type="103" groupAlignment="0" attributes="0">
24+
<Component id="childDirectoryNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
2425
<Component id="childThemeNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
26+
</Group>
27+
<EmptySpace max="-2" attributes="0"/>
28+
<Group type="103" groupAlignment="0" attributes="0">
29+
<Component id="childDirectoryNameTextField" max="32767" attributes="0"/>
30+
<Component id="childThemeNameTextField" max="32767" attributes="0"/>
31+
</Group>
32+
</Group>
33+
<Group type="102" alignment="0" attributes="0">
34+
<Group type="103" groupAlignment="0" attributes="0">
2535
<Component id="descriptionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
2636
<Component id="childThemeUriLabel" alignment="0" min="-2" max="-2" attributes="0"/>
2737
<Component id="versionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
2838
<Component id="authorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
29-
<Component id="parentThemeLabel" alignment="0" min="-2" max="-2" attributes="0"/>
3039
<Component id="authorUriLabel" alignment="0" min="-2" max="-2" attributes="0"/>
40+
<Component id="tagsLabel" alignment="0" min="-2" max="-2" attributes="0"/>
41+
<Component id="textDomainLabel" alignment="0" min="-2" max="-2" attributes="0"/>
3142
</Group>
32-
<EmptySpace max="-2" attributes="0"/>
43+
<EmptySpace min="-2" pref="48" max="-2" attributes="0"/>
3344
<Group type="103" groupAlignment="0" attributes="0">
34-
<Component id="parentThemeComboBox" max="32767" attributes="0"/>
35-
<Component id="childThemeNameTextField" max="32767" attributes="0"/>
45+
<Component id="textDomainTextField" max="32767" attributes="0"/>
46+
<Component id="tagsTextField" max="32767" attributes="0"/>
3647
<Component id="childThemeUriTextField" alignment="0" max="32767" attributes="0"/>
3748
<Component id="descriptionTextField" alignment="0" max="32767" attributes="0"/>
3849
<Component id="versionTextField" alignment="0" max="32767" attributes="0"/>
3950
<Component id="authorTextField" alignment="0" max="32767" attributes="0"/>
4051
<Component id="authorUriTextField" alignment="0" max="32767" attributes="0"/>
4152
</Group>
4253
</Group>
43-
<Group type="102" alignment="0" attributes="0">
44-
<Component id="tagsLabel" min="-2" max="-2" attributes="0"/>
45-
<EmptySpace min="-2" pref="110" max="-2" attributes="0"/>
46-
<Component id="tagsTextField" max="32767" attributes="0"/>
47-
</Group>
48-
<Group type="102" alignment="0" attributes="0">
49-
<Component id="textDomainLabel" min="-2" max="-2" attributes="0"/>
50-
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
51-
<Component id="textDomainTextField" max="32767" attributes="0"/>
52-
</Group>
53-
<Group type="102" alignment="0" attributes="0">
54+
<Group type="102" attributes="0">
5455
<Component id="errorLabel" min="-2" max="-2" attributes="0"/>
5556
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
5657
</Group>
58+
<Group type="102" alignment="0" attributes="0">
59+
<Component id="parentThemeLabel" min="-2" max="-2" attributes="0"/>
60+
<EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
61+
<Component id="parentThemeComboBox" max="32767" attributes="0"/>
62+
</Group>
5763
</Group>
5864
<EmptySpace max="-2" attributes="0"/>
5965
</Group>
@@ -68,11 +74,16 @@
6874
<Component id="parentThemeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
6975
</Group>
7076
<EmptySpace max="-2" attributes="0"/>
77+
<Group type="103" groupAlignment="3" attributes="0">
78+
<Component id="childDirectoryNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
79+
<Component id="childDirectoryNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
80+
</Group>
81+
<EmptySpace max="-2" attributes="0"/>
7182
<Group type="103" groupAlignment="3" attributes="0">
7283
<Component id="childThemeNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
7384
<Component id="childThemeNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
7485
</Group>
75-
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
86+
<EmptySpace max="-2" attributes="0"/>
7687
<Group type="103" groupAlignment="3" attributes="0">
7788
<Component id="childThemeUriLabel" alignment="3" min="-2" max="-2" attributes="0"/>
7889
<Component id="childThemeUriTextField" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -132,17 +143,17 @@
132143
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
133144
</AuxValues>
134145
</Component>
135-
<Component class="javax.swing.JLabel" name="childThemeNameLabel">
146+
<Component class="javax.swing.JLabel" name="childDirectoryNameLabel">
136147
<Properties>
137148
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
138-
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties" key="CreateChildThemePanel.childThemeNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
149+
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties" key="CreateChildThemePanel.childDirectoryNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
139150
</Property>
140151
</Properties>
141152
</Component>
142-
<Component class="javax.swing.JTextField" name="childThemeNameTextField">
153+
<Component class="javax.swing.JTextField" name="childDirectoryNameTextField">
143154
<Properties>
144155
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
145-
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties" key="CreateChildThemePanel.childThemeNameTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
156+
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties" key="CreateChildThemePanel.childDirectoryNameTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
146157
</Property>
147158
</Properties>
148159
</Component>
@@ -251,5 +262,19 @@
251262
</Property>
252263
</Properties>
253264
</Component>
265+
<Component class="javax.swing.JLabel" name="childThemeNameLabel">
266+
<Properties>
267+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
268+
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties" key="CreateChildThemePanel.childThemeNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
269+
</Property>
270+
</Properties>
271+
</Component>
272+
<Component class="javax.swing.JTextField" name="childThemeNameTextField">
273+
<Properties>
274+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
275+
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/wizards/Bundle.properties" key="CreateChildThemePanel.childThemeNameTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
276+
</Property>
277+
</Properties>
278+
</Component>
254279
</SubComponents>
255280
</Form>

src/org/netbeans/modules/php/wordpress/ui/wizards/CreateChildThemePanel.java

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public CreateChildThemePanel(List<String> themes) {
6666
initComponents();
6767
DefaultComboBoxModel<String> defaultComboBoxModel = new DefaultComboBoxModel<String>(themes.toArray(new String[0]));
6868
parentThemeComboBox.setModel(defaultComboBoxModel);
69-
childThemeNameTextField.getDocument().addDocumentListener(new DefaultDocumentListener());
69+
childDirectoryNameTextField.getDocument().addDocumentListener(new DefaultDocumentListener());
7070
errorLabel.setText(" "); // NOI18N
7171
errorLabel.setForeground(UIManager.getColor("nb.errorForeground")); // NOI18N
7272
}
@@ -87,6 +87,10 @@ public String getParentThemeName() {
8787
return (String) parentThemeComboBox.getSelectedItem();
8888
}
8989

90+
public String getChildDirectoryName() {
91+
return childDirectoryNameTextField.getText().trim();
92+
}
93+
9094
public String getChildThemeName() {
9195
return childThemeNameTextField.getText().trim();
9296
}
@@ -134,8 +138,8 @@ private void initComponents() {
134138

135139
parentThemeLabel = new javax.swing.JLabel();
136140
parentThemeComboBox = new javax.swing.JComboBox<String>();
137-
childThemeNameLabel = new javax.swing.JLabel();
138-
childThemeNameTextField = new javax.swing.JTextField();
141+
childDirectoryNameLabel = new javax.swing.JLabel();
142+
childDirectoryNameTextField = new javax.swing.JTextField();
139143
errorLabel = new javax.swing.JLabel();
140144
childThemeUriLabel = new javax.swing.JLabel();
141145
descriptionLabel = new javax.swing.JLabel();
@@ -151,12 +155,14 @@ private void initComponents() {
151155
textDomainTextField = new javax.swing.JTextField();
152156
authorUriLabel = new javax.swing.JLabel();
153157
authorUriTextField = new javax.swing.JTextField();
158+
childThemeNameLabel = new javax.swing.JLabel();
159+
childThemeNameTextField = new javax.swing.JTextField();
154160

155161
org.openide.awt.Mnemonics.setLocalizedText(parentThemeLabel, org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.parentThemeLabel.text")); // NOI18N
156162

157-
org.openide.awt.Mnemonics.setLocalizedText(childThemeNameLabel, org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.childThemeNameLabel.text")); // NOI18N
163+
org.openide.awt.Mnemonics.setLocalizedText(childDirectoryNameLabel, org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.childDirectoryNameLabel.text")); // NOI18N
158164

159-
childThemeNameTextField.setText(org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.childThemeNameTextField.text")); // NOI18N
165+
childDirectoryNameTextField.setText(org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.childDirectoryNameTextField.text")); // NOI18N
160166

161167
org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.errorLabel.text")); // NOI18N
162168

@@ -188,6 +194,10 @@ private void initComponents() {
188194

189195
authorUriTextField.setText(org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.authorUriTextField.text")); // NOI18N
190196

197+
org.openide.awt.Mnemonics.setLocalizedText(childThemeNameLabel, org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.childThemeNameLabel.text")); // NOI18N
198+
199+
childThemeNameTextField.setText(org.openide.util.NbBundle.getMessage(CreateChildThemePanel.class, "CreateChildThemePanel.childThemeNameTextField.text")); // NOI18N
200+
191201
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
192202
this.setLayout(layout);
193203
layout.setHorizontalGroup(
@@ -197,33 +207,37 @@ private void initComponents() {
197207
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
198208
.addGroup(layout.createSequentialGroup()
199209
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
200-
.addComponent(childThemeNameLabel)
210+
.addComponent(childDirectoryNameLabel)
211+
.addComponent(childThemeNameLabel))
212+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
213+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
214+
.addComponent(childDirectoryNameTextField)
215+
.addComponent(childThemeNameTextField)))
216+
.addGroup(layout.createSequentialGroup()
217+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
201218
.addComponent(descriptionLabel)
202219
.addComponent(childThemeUriLabel)
203220
.addComponent(versionLabel)
204221
.addComponent(authorLabel)
205-
.addComponent(parentThemeLabel)
206-
.addComponent(authorUriLabel))
207-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
222+
.addComponent(authorUriLabel)
223+
.addComponent(tagsLabel)
224+
.addComponent(textDomainLabel))
225+
.addGap(48, 48, 48)
208226
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
209-
.addComponent(parentThemeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
210-
.addComponent(childThemeNameTextField)
227+
.addComponent(textDomainTextField)
228+
.addComponent(tagsTextField)
211229
.addComponent(childThemeUriTextField)
212230
.addComponent(descriptionTextField)
213231
.addComponent(versionTextField)
214232
.addComponent(authorTextField)
215233
.addComponent(authorUriTextField)))
216-
.addGroup(layout.createSequentialGroup()
217-
.addComponent(tagsLabel)
218-
.addGap(110, 110, 110)
219-
.addComponent(tagsTextField))
220-
.addGroup(layout.createSequentialGroup()
221-
.addComponent(textDomainLabel)
222-
.addGap(55, 55, 55)
223-
.addComponent(textDomainTextField))
224234
.addGroup(layout.createSequentialGroup()
225235
.addComponent(errorLabel)
226-
.addGap(0, 0, Short.MAX_VALUE)))
236+
.addGap(0, 0, Short.MAX_VALUE))
237+
.addGroup(layout.createSequentialGroup()
238+
.addComponent(parentThemeLabel)
239+
.addGap(60, 60, 60)
240+
.addComponent(parentThemeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
227241
.addContainerGap())
228242
);
229243
layout.setVerticalGroup(
@@ -234,10 +248,14 @@ private void initComponents() {
234248
.addComponent(parentThemeLabel)
235249
.addComponent(parentThemeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
236250
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
251+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
252+
.addComponent(childDirectoryNameLabel)
253+
.addComponent(childDirectoryNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
254+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
237255
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
238256
.addComponent(childThemeNameLabel)
239257
.addComponent(childThemeNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
240-
.addGap(6, 6, 6)
258+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
241259
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
242260
.addComponent(childThemeUriLabel)
243261
.addComponent(childThemeUriTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@@ -276,6 +294,8 @@ private void initComponents() {
276294
private javax.swing.JTextField authorTextField;
277295
private javax.swing.JLabel authorUriLabel;
278296
private javax.swing.JTextField authorUriTextField;
297+
private javax.swing.JLabel childDirectoryNameLabel;
298+
private javax.swing.JTextField childDirectoryNameTextField;
279299
private javax.swing.JLabel childThemeNameLabel;
280300
private javax.swing.JTextField childThemeNameTextField;
281301
private javax.swing.JLabel childThemeUriLabel;

0 commit comments

Comments
 (0)