@@ -22,12 +22,11 @@ public class AddTypeScriptRef extends JDialog {
22
22
private JTextField nameTextField ;
23
23
private JTextPane errorTextPane ;
24
24
private JTextPane infoTextPane ;
25
+ private JCheckBox onlyTypeScriptDefinitionsCheckBox ;
25
26
26
27
private String selectedDirectory ;
27
- private StringBuilder errorMessageBuilder = new StringBuilder ();
28
28
private String errorMessage ;
29
29
30
- private String initialDtoName ;
31
30
private Module module ;
32
31
33
32
public AddTypeScriptRef (Module module ) {
@@ -169,14 +168,21 @@ public void actionPerformed(ActionEvent e) {
169
168
}
170
169
171
170
private void onOK () {
171
+ StringBuilder errorMessageBuilder = new StringBuilder ();
172
172
AddTypeScriptRefHandler .handleOk (
173
173
this .module ,
174
174
this .addressUrlTextField .getText (),
175
175
this .nameTextField .getText (),
176
176
this .selectedDirectory ,
177
- this .errorMessageBuilder
177
+ this .onlyTypeScriptDefinitionsCheckBox .isSelected (),
178
+ errorMessageBuilder
178
179
);
179
- dispose ();
180
+ if (errorMessageBuilder .toString ().length () > 0 ) {
181
+ errorTextPane .setText (errorMessageBuilder .toString ());
182
+ errorTextPane .setVisible (true );
183
+ } else {
184
+ dispose ();
185
+ }
180
186
}
181
187
182
188
private void onCancel () {
@@ -190,6 +196,7 @@ public static void main(String[] args) {
190
196
dialog .setVisible (true );
191
197
System .exit (0 );
192
198
}
199
+
193
200
private ImageIcon createImageIcon (String path , String description ) {
194
201
URL imgURL = getClass ().getResource (path );
195
202
if (imgURL != null ) {
@@ -210,11 +217,11 @@ public void setSelectedDirectory(String selectedDirectory) {
210
217
}
211
218
212
219
public String getInitialDtoName () {
213
- return initialDtoName ;
220
+ return this . nameTextField . getText () ;
214
221
}
215
222
216
223
public void setInitialDtoName (String initialDtoName ) {
217
- this .initialDtoName = initialDtoName ;
224
+ this .nameTextField . setText ( initialDtoName ) ;
218
225
}
219
226
220
227
{
@@ -239,19 +246,23 @@ public void setInitialDtoName(String initialDtoName) {
239
246
contentPane .setPreferredSize (new Dimension (550 , 220 ));
240
247
contentPane .setRequestFocusEnabled (false );
241
248
final JPanel panel1 = new JPanel ();
242
- panel1 .setLayout (new GridLayoutManager (1 , 2 , new Insets (0 , 0 , 0 , 0 ), -1 , -1 ));
249
+ panel1 .setLayout (new GridLayoutManager (1 , 3 , new Insets (0 , 0 , 0 , 0 ), -1 , -1 ));
243
250
contentPane .add (panel1 , new GridConstraints (2 , 0 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_BOTH , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , 1 , null , null , null , 0 , false ));
244
251
final Spacer spacer1 = new Spacer ();
245
- panel1 .add (spacer1 , new GridConstraints (0 , 0 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_HORIZONTAL , GridConstraints .SIZEPOLICY_WANT_GROW , 1 , null , null , null , 0 , false ));
252
+ panel1 .add (spacer1 , new GridConstraints (0 , 1 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_HORIZONTAL , GridConstraints .SIZEPOLICY_WANT_GROW , 1 , null , null , null , 0 , false ));
246
253
final JPanel panel2 = new JPanel ();
247
254
panel2 .setLayout (new GridLayoutManager (1 , 2 , new Insets (0 , 0 , 0 , 0 ), -1 , -1 , true , false ));
248
- panel1 .add (panel2 , new GridConstraints (0 , 1 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_BOTH , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , null , null , null , 0 , false ));
255
+ panel1 .add (panel2 , new GridConstraints (0 , 2 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_BOTH , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , null , null , null , 0 , false ));
249
256
buttonOK = new JButton ();
250
257
buttonOK .setText ("OK" );
251
258
panel2 .add (buttonOK , new GridConstraints (0 , 0 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_HORIZONTAL , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , GridConstraints .SIZEPOLICY_FIXED , null , null , null , 0 , false ));
252
259
buttonCancel = new JButton ();
253
260
buttonCancel .setText ("Cancel" );
254
261
panel2 .add (buttonCancel , new GridConstraints (0 , 1 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_HORIZONTAL , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , GridConstraints .SIZEPOLICY_FIXED , null , null , null , 0 , false ));
262
+ onlyTypeScriptDefinitionsCheckBox = new JCheckBox ();
263
+ onlyTypeScriptDefinitionsCheckBox .setSelected (true );
264
+ onlyTypeScriptDefinitionsCheckBox .setText ("Only TypeScript definitions" );
265
+ panel1 .add (onlyTypeScriptDefinitionsCheckBox , new GridConstraints (0 , 0 , 1 , 1 , GridConstraints .ANCHOR_WEST , GridConstraints .FILL_NONE , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , GridConstraints .SIZEPOLICY_FIXED , null , null , null , 0 , false ));
255
266
final JPanel panel3 = new JPanel ();
256
267
panel3 .setLayout (new GridLayoutManager (2 , 3 , new Insets (0 , 0 , 0 , 0 ), -1 , -1 ));
257
268
contentPane .add (panel3 , new GridConstraints (1 , 0 , 1 , 1 , GridConstraints .ANCHOR_CENTER , GridConstraints .FILL_BOTH , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , GridConstraints .SIZEPOLICY_CAN_SHRINK | GridConstraints .SIZEPOLICY_CAN_GROW , null , null , null , 0 , false ));
@@ -265,7 +276,7 @@ public void setInitialDtoName(String initialDtoName) {
265
276
label2 .setText ("Name" );
266
277
panel3 .add (label2 , new GridConstraints (1 , 0 , 1 , 1 , GridConstraints .ANCHOR_WEST , GridConstraints .FILL_NONE , GridConstraints .SIZEPOLICY_FIXED , GridConstraints .SIZEPOLICY_FIXED , null , null , null , 0 , false ));
267
278
nameTextField = new JTextField ();
268
- nameTextField .setText ("dtos.java " );
279
+ nameTextField .setText ("" );
269
280
panel3 .add (nameTextField , new GridConstraints (1 , 1 , 1 , 2 , GridConstraints .ANCHOR_WEST , GridConstraints .FILL_HORIZONTAL , GridConstraints .SIZEPOLICY_WANT_GROW , GridConstraints .SIZEPOLICY_FIXED , null , new Dimension (150 , -1 ), null , 0 , false ));
270
281
final JPanel panel4 = new JPanel ();
271
282
panel4 .setLayout (new GridLayoutManager (2 , 1 , new Insets (0 , 0 , 0 , 0 ), -1 , -1 ));
0 commit comments