@@ -165,6 +165,25 @@ public String toString() {
165
165
new Language (_ ("Western Frisian" ), "Western Frisian" , "fy" ),
166
166
};
167
167
168
+ private static class WarningItem {
169
+ private final String value ;
170
+ private final String translation ;
171
+
172
+ public WarningItem (String value , String translation ) {
173
+ this .value = value ;
174
+ this .translation = translation ;
175
+ }
176
+
177
+ public String getValue () {
178
+ return value ;
179
+ }
180
+
181
+ @ Override
182
+ public String toString () {
183
+ return translation ;
184
+ }
185
+ }
186
+
168
187
/**
169
188
* Standardized width for buttons. Mac OS X 10.3 wants 70 as its default,
170
189
* Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper.
@@ -203,14 +222,14 @@ public String toString() {
203
222
JCheckBox verboseCompilationBox ;
204
223
JCheckBox verboseUploadBox ;
205
224
JCheckBox displayLineNumbersBox ;
206
- JCheckBox enableCompilerWarningsBox ;
207
225
JCheckBox verifyUploadBox ;
208
226
JCheckBox externalEditorBox ;
209
227
JCheckBox checkUpdatesBox ;
210
228
JTextField fontSizeField ;
211
229
JCheckBox updateExtensionBox ;
212
230
JCheckBox autoAssociateBox ;
213
231
JComboBox comboLanguage ;
232
+ JComboBox comboWarnings ;
214
233
JCheckBox saveVerifyUploadBox ;
215
234
JTextField proxyHTTPServer ;
216
235
JTextField proxyHTTPPort ;
@@ -355,10 +374,22 @@ public void actionPerformed(ActionEvent e) {
355
374
356
375
// [ ] Enable all compiler warnings
357
376
358
- enableCompilerWarningsBox = new JCheckBox (_ ("Enable all compiler warnings" ));
359
- pane .add (enableCompilerWarningsBox );
360
- d = enableCompilerWarningsBox .getPreferredSize ();
361
- enableCompilerWarningsBox .setBounds (left , top , d .width + 10 , d .height );
377
+ box = Box .createHorizontalBox ();
378
+ label = new JLabel (_ ("Compiler warnings: " ));
379
+ box .add (label );
380
+ WarningItem [] warningItems = new WarningItem []{new WarningItem ("none" , _ ("none" )), new WarningItem ("normal" , _ ("normal" )), new WarningItem ("all" , _ ("all" )), new WarningItem ("extra" , _ ("extra" )), };
381
+ comboWarnings = new JComboBox (warningItems );
382
+ String currentWarningLevel = PreferencesData .get ("compiler.warning_flags" , "none" );
383
+ for (WarningItem item : warningItems ) {
384
+ if (currentWarningLevel .equals (item .getValue ())) {
385
+ comboWarnings .setSelectedItem (item );
386
+ }
387
+ }
388
+ box .add (comboWarnings );
389
+ pane .add (box );
390
+ d = box .getPreferredSize ();
391
+ box .setForeground (Color .gray );
392
+ box .setBounds (left , top , d .width , d .height );
362
393
right = Math .max (right , left + d .width );
363
394
top += d .height + GUI_BETWEEN ;
364
395
@@ -682,7 +713,6 @@ protected void applyFrame() {
682
713
PreferencesData .setBoolean ("editor.linenumbers" , displayLineNumbersBox .isSelected ());
683
714
PreferencesData .setBoolean ("upload.verify" , verifyUploadBox .isSelected ());
684
715
PreferencesData .setBoolean ("editor.save_on_verify" , saveVerifyUploadBox .isSelected ());
685
- PreferencesData .setBoolean ("build.allwarnings" , enableCompilerWarningsBox .isSelected ());
686
716
687
717
// setBoolean("sketchbook.closing_last_window_quits",
688
718
// closingLastQuitsBox.isSelected());
@@ -740,6 +770,9 @@ protected void applyFrame() {
740
770
Language newLanguage = (Language ) comboLanguage .getSelectedItem ();
741
771
PreferencesData .set ("editor.languages.current" , newLanguage .isoCode );
742
772
773
+ WarningItem warningItem = (WarningItem ) comboWarnings .getSelectedItem ();
774
+ PreferencesData .set ("compiler.warning_flags" , warningItem .getValue ());
775
+
743
776
Preferences .set ("proxy.http.server" , proxyHTTPServer .getText ());
744
777
try {
745
778
Preferences .set ("proxy.http.port" , Integer .valueOf (proxyHTTPPort .getText ()).toString ());
@@ -767,7 +800,6 @@ protected void showFrame(Editor editor) {
767
800
verboseUploadBox .setSelected (PreferencesData .getBoolean ("upload.verbose" ));
768
801
displayLineNumbersBox .setSelected (PreferencesData .getBoolean ("editor.linenumbers" ));
769
802
verifyUploadBox .setSelected (PreferencesData .getBoolean ("upload.verify" ));
770
- enableCompilerWarningsBox .setSelected (PreferencesData .getBoolean ("build.allwarnings" ));
771
803
772
804
//closingLastQuitsBox.
773
805
// setSelected(getBoolean("sketchbook.closing_last_window_quits"));
0 commit comments