-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSettingsComponent.java
More file actions
650 lines (519 loc) · 27.1 KB
/
SettingsComponent.java
File metadata and controls
650 lines (519 loc) · 27.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
package org.overengineer.inlineproblems.settings;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.ui.ColorPanel;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBTextField;
import com.intellij.util.ui.FormBuilder;
import lombok.Getter;
import org.overengineer.inlineproblems.DocumentMarkupModelScanner;
import org.overengineer.inlineproblems.bundles.SettingsBundle;
import org.overengineer.inlineproblems.listeners.HighlightProblemListener;
import org.overengineer.inlineproblems.listeners.MarkupModelProblemListener;
import javax.swing.*;
import javax.swing.text.NumberFormatter;
import java.awt.*;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.List;
public class SettingsComponent {
private final JBCheckBox showErrors = new JBCheckBox(SettingsBundle.message("settings.showErrors"));
private final JBCheckBox highlightErrors = new JBCheckBox(SettingsBundle.message("settings.highlightErrors"));
private final JBCheckBox showErrorsInGutter = new JBCheckBox(SettingsBundle.message("settings.showErrorsInGutter"));
private final JBCheckBox showWarnings = new JBCheckBox(SettingsBundle.message("settings.showWarnings"));
private final JBCheckBox highlightWarnings = new JBCheckBox(SettingsBundle.message("settings.highlightWarnings"));
private final JBCheckBox showWarningsInGutter = new JBCheckBox(SettingsBundle.message("settings.showWarningsInGutter"));
private final JBCheckBox showWeakWarnings = new JBCheckBox(SettingsBundle.message("settings.showWeakWarnings"));
private final JBCheckBox highlightWeakWarnings = new JBCheckBox(SettingsBundle.message("settings.highlightWeakWarnings"));
private final JBCheckBox showWeakWarningsInGutter = new JBCheckBox(SettingsBundle.message("settings.showWeakWarningsInGutter"));
private final JBCheckBox showInfos = new JBCheckBox(SettingsBundle.message("settings.showInfos"));
private final JBCheckBox highlightInfo = new JBCheckBox(SettingsBundle.message("settings.highlightInfos"));
private final JBCheckBox showInfosInGutter = new JBCheckBox(SettingsBundle.message("settings.showInfosInGutter"));
private final ColorPanel errorTextColor = new ColorPanel();
private final ColorPanel errorLabelBackgroundColor = new ColorPanel();
private final ColorPanel errorHighlightColor = new ColorPanel();
private final ColorPanel warningTextColor = new ColorPanel();
private final ColorPanel warningLabelBackgroundColor = new ColorPanel();
private final ColorPanel warningHighlightColor = new ColorPanel();
private final ColorPanel weakWarningTextColor = new ColorPanel();
private final ColorPanel weakWarningLabelBackgroundColor = new ColorPanel();
private final ColorPanel weakWarningHighlightColor = new ColorPanel();
private final ColorPanel infoTextColor = new ColorPanel();
private final ColorPanel infoLabelBackgroundColor = new ColorPanel();
private final ColorPanel infoHighlightColor = new ColorPanel();
private final JBCheckBox forceErrorsInSameLine = new JBCheckBox(SettingsBundle.message("settings.forceProblemsInOneLine"));
private final JBCheckBox drawBoxesAroundProblemLabels = new JBCheckBox(SettingsBundle.message("settings.drawBoxesAroundProblemLabels"));
private final JBCheckBox roundedCornerBoxes = new JBCheckBox(SettingsBundle.message("settings.roundedCornerBoxes"));
private final JBCheckBox useEditorFont = new JBCheckBox(SettingsBundle.message("settings.useEditorFont"));
private final JBCheckBox showOnlyHighestSeverityPerLine = new JBCheckBox(SettingsBundle.message("settings.showOnlyHighestPerLine"));
private final JBCheckBox enableHtmlStripping = new JBCheckBox(SettingsBundle.message("settings.enableHtmlStripping"));
private final JBCheckBox enableXmlUnescaping = new JBCheckBox(SettingsBundle.message("settings.enableXmlUnescaping"));
private final JFormattedTextField inlayFontSizeDeltaText;
private final JFormattedTextField manualScannerDelay;
private final JFormattedTextField maxProblemsPerLine;
private final JFormattedTextField maxFileLines;
private final JBCheckBox fillProblemLabels = new JBCheckBox(SettingsBundle.message("settings.fillProblemLabels"));
private final JBCheckBox boldProblemLabels = new JBCheckBox(SettingsBundle.message("settings.boldProblemLabels"));
private final JBCheckBox italicProblemLabels = new JBCheckBox(SettingsBundle.message("settings.italicProblemLabels"));
private final JBTextField problemFilterList = new JBTextField();
private final JBTextField fileExtensionBlacklist = new JBTextField();
private final String[] availableListeners = {HighlightProblemListener.NAME, MarkupModelProblemListener.NAME, DocumentMarkupModelScanner.NAME};
private final JComboBox<String> enabledListener = new ComboBox<>(availableListeners);
private final JBTextField additionalInfoSeverities = new JBTextField();
private final JBTextField additionalWarningSeverities = new JBTextField();
private final JBTextField additionalWeakWarningSeverities = new JBTextField();
private final JBTextField additionalErrorSeverities = new JBTextField();
@Getter
private final JPanel settingsPanel;
public SettingsComponent() {
SettingsState settingsState = SettingsState.getInstance();
showErrors.setSelected(settingsState.isShowErrors());
highlightErrors.setSelected(settingsState.isHighlightErrors());
showErrorsInGutter.setSelected(settingsState.isShowErrorsInGutter());
errorTextColor.setSelectedColor(settingsState.getErrorTextColor());
errorLabelBackgroundColor.setSelectedColor(settingsState.getErrorBackgroundColor());
errorHighlightColor.setSelectedColor(settingsState.getErrorHighlightColor());
showWarnings.setSelected(settingsState.isShowWarnings());
highlightWarnings.setSelected(settingsState.isHighlightWarnings());
showWarningsInGutter.setSelected(settingsState.isShowWarningsInGutter());
warningTextColor.setSelectedColor(settingsState.getWarningTextColor());
warningLabelBackgroundColor.setSelectedColor(settingsState.getWarningBackgroundColor());
warningHighlightColor.setSelectedColor(settingsState.getWarningHighlightColor());
showWeakWarnings.setSelected(settingsState.isShowWeakWarnings());
highlightWeakWarnings.setSelected(settingsState.isHighlightWeakWarnings());
showWeakWarningsInGutter.setSelected(settingsState.isShowWeakWarningsInGutter());
weakWarningTextColor.setSelectedColor(settingsState.getWeakWarningTextColor());
weakWarningLabelBackgroundColor.setSelectedColor(settingsState.getWeakWarningBackgroundColor());
weakWarningHighlightColor.setSelectedColor(settingsState.getWeakWarningHighlightColor());
showInfos.setSelected(settingsState.isShowInfos());
highlightInfo.setSelected(settingsState.isHighlightInfos());
showInfosInGutter.setSelected(settingsState.isShowInfosInGutter());
infoTextColor.setSelectedColor(settingsState.getInfoTextColor());
infoLabelBackgroundColor.setSelectedColor(settingsState.getInfoBackgroundColor());
infoHighlightColor.setSelectedColor(settingsState.getInfoHighlightColor());
forceErrorsInSameLine.setSelected(settingsState.isForceProblemsInSameLine());
drawBoxesAroundProblemLabels.setSelected(settingsState.isDrawBoxesAroundErrorLabels());
roundedCornerBoxes.setSelected(settingsState.isRoundedCornerBoxes());
useEditorFont.setSelected(settingsState.isUseEditorFont());
NumberFormat intFormat = NumberFormat.getIntegerInstance();
intFormat.setGroupingUsed(false);
NumberFormatter numberFormatter = new NumberFormatter(intFormat);
numberFormatter.setValueClass(Integer.class); // Optional, ensures we always get a int value
inlayFontSizeDeltaText = new JFormattedTextField(numberFormatter);
inlayFontSizeDeltaText.setText(Integer.toString(settingsState.getInlayFontSizeDelta()));
maxProblemsPerLine = new JFormattedTextField(numberFormatter);
maxProblemsPerLine.setText(Integer.toString(settingsState.getMaxProblemsPerLine()));
manualScannerDelay = new JFormattedTextField(numberFormatter);
manualScannerDelay.setText(Integer.toString(settingsState.getManualScannerDelay()));
maxFileLines = new JFormattedTextField(numberFormatter);
maxFileLines.setText(Integer.toString(settingsState.getMaxFileLines()));
fillProblemLabels.setSelected(settingsState.isFillProblemLabels());
boldProblemLabels.setSelected(settingsState.isBoldProblemLabels());
italicProblemLabels.setSelected(settingsState.isItalicProblemLabels());
additionalInfoSeverities.setText(settingsState.getAdditionalInfoSeveritiesAsString());
additionalWeakWarningSeverities.setText(settingsState.getAdditionalWeakWarningSeveritiesAsString());
additionalWarningSeverities.setText(settingsState.getAdditionalWarningSeveritiesAsString());
additionalErrorSeverities.setText(settingsState.getAdditionalErrorSeveritiesAsString());
problemFilterList.setText(settingsState.getProblemFilterList());
fileExtensionBlacklist.setText(settingsState.getFileExtensionBlacklist());
enabledListener.setSelectedItem(Optional.of(settingsState.getEnabledListener()));
Dimension enabledListenerDimension = enabledListener.getPreferredSize();
enabledListenerDimension.width += 100;
enabledListener.setPreferredSize(enabledListenerDimension);
settingsPanel = FormBuilder.createFormBuilder()
.addComponent(new JBLabel(SettingsBundle.message("settings.submenu.label")))
.addComponent(drawBoxesAroundProblemLabels, 0)
.addComponent(roundedCornerBoxes, 0)
.addComponent(fillProblemLabels, 0)
.addComponent(boldProblemLabels, 0)
.addComponent(italicProblemLabels, 0)
.addSeparator()
.addComponent(new JBLabel(SettingsBundle.message("settings.submenu.general")))
.addLabeledComponent(new JBLabel(SettingsBundle.message("settings.activeProblemListener")), enabledListener)
.addTooltip(SettingsBundle.message("settings.markupModelListenerDescription"))
.addTooltip(SettingsBundle.message("settings.highlightProblemListenerDescription"))
.addTooltip(SettingsBundle.message("settings.manualScannerDescription"))
.addTooltip(SettingsBundle.message("settings.manualScannerDescriptionSupplement"))
.addLabeledComponent(new JBLabel(SettingsBundle.message("settings.manualScannerDelayLabel")), manualScannerDelay)
.addTooltip(SettingsBundle.message("settings.manualScannerDelayTooltip"))
.addComponent(forceErrorsInSameLine, 0)
.addComponent(useEditorFont, 0)
.addComponent(showOnlyHighestSeverityPerLine, 0)
.addComponent(enableHtmlStripping, 0)
.addComponent(enableXmlUnescaping, 0)
.addLabeledComponent(new JBLabel(SettingsBundle.message("settings.inlaySizeDelta")), inlayFontSizeDeltaText)
.addTooltip(SettingsBundle.message("settings.inlaySizeDeltaTooltip"))
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.problemFilterListLabel")), problemFilterList)
.addTooltip(SettingsBundle.message("settings.problemFilterListTooltip"))
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.fileExtensionBlacklistLabel")), fileExtensionBlacklist)
.addTooltip(SettingsBundle.message("settings.fileExtensionBlacklistTooltip"))
.addLabeledComponent(new JBLabel(SettingsBundle.message("settings.maxProblemsPerLineLabel")), maxProblemsPerLine)
.addTooltip(SettingsBundle.message("settings.maxProblemsPerLineTooltip"))
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.maxFileLinesLabel")), maxFileLines)
.addTooltip(SettingsBundle.message("settings.maxFileLinesTooltip"))
.addSeparator()
.addComponent(new JBLabel(SettingsBundle.message("settings.submenu.colors")))
.addComponent(showErrors)
.addComponent(highlightErrors)
.addComponent(showErrorsInGutter)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.errorTextColor")), errorTextColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.errorLabelBorderColor")), errorLabelBackgroundColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.errorLineHighlightColor")), errorHighlightColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.additionalSeverities")), additionalErrorSeverities)
.addTooltip(SettingsBundle.message("settings.additionalSeveritiesErrorDesc"))
.addSeparator()
.addComponent(showWarnings)
.addComponent(highlightWarnings)
.addComponent(showWarningsInGutter)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.warningTextColor")), warningTextColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.warningLabelBorderColor")), warningLabelBackgroundColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.warningLineHighlightColor")), warningHighlightColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.additionalSeverities")), additionalWarningSeverities)
.addTooltip(SettingsBundle.message("settings.additionalSeveritiesWarningDesc"))
.addSeparator()
.addComponent(showWeakWarnings)
.addComponent(highlightWeakWarnings)
.addComponent(showWeakWarningsInGutter)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.weakWarningTextColor")), weakWarningTextColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.weakWarningLabelBorderColor")), weakWarningLabelBackgroundColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.weakWarningLineHighlightColor")), weakWarningHighlightColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.additionalSeverities")), additionalWeakWarningSeverities)
.addTooltip(SettingsBundle.message("settings.additionalSeveritiesWeakWarningDesc"))
.addSeparator()
.addComponent(showInfos)
.addComponent(highlightInfo)
.addComponent(showInfosInGutter)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.infoTextColor")), infoTextColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.infoLabelBorderColor")), infoLabelBackgroundColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.infoLineHighlightColor")), infoHighlightColor)
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.additionalSeverities")), additionalInfoSeverities)
.addTooltip(SettingsBundle.message("settings.additionalSeveritiesInfoDesc"))
.addComponentFillVertically(new JPanel(), 0)
.getPanel();
}
public JComponent getPreferredFocusedComponent() {
return settingsPanel;
}
public boolean isForceErrorsInSameLine() {
return forceErrorsInSameLine.isSelected();
}
public void setForceErrorsInSameLine(final boolean isSelected) {
forceErrorsInSameLine.setSelected(isSelected);
}
public boolean getDrawBoxesAroundProblemLabels() {
return drawBoxesAroundProblemLabels.isSelected();
}
public void setDrawBoxesAroundProblemLabels(final boolean isSelected) {
drawBoxesAroundProblemLabels.setSelected(isSelected);
}
public boolean isRoundedCornerBoxes() {
return roundedCornerBoxes.isSelected();
}
public void setRoundedCornerBoxes(boolean isSelected) {
roundedCornerBoxes.setSelected(isSelected);
}
public boolean isUseEditorFont() {
return useEditorFont.isSelected();
}
public boolean isShowOnlyHighestSeverityPerLine() {
return showOnlyHighestSeverityPerLine.isSelected();
}
public boolean isEnableHtmlStripping() {
return enableHtmlStripping.isSelected();
}
public boolean isEnableXmlUnescaping() {
return enableXmlUnescaping.isSelected();
}
public int getInlayFontSizeDelta() {
int val = 0;
// Convert the String
try {
val = Integer.parseInt(inlayFontSizeDeltaText.getText());
}
catch (NumberFormatException ignored) {}
if (val < 0)
val = 0;
return val;
}
public void setInlayFontSizeDelta(int val) {
inlayFontSizeDeltaText.setText(String.valueOf(Math.max(0, val)));
}
public void setUseEditorFont(boolean isSelected) {
useEditorFont.setSelected(isSelected);
}
public void setShowOnlyHighestSeverityPerLine(boolean isSelected) {
showOnlyHighestSeverityPerLine.setSelected(isSelected);
}
public void setEnableHtmlStripping(boolean isSelected) {
enableHtmlStripping.setSelected(isSelected);
}
public void setEnableXmlUnescaping(boolean isSelected) {
enableXmlUnescaping.setSelected(isSelected);
}
public boolean isFillProblemLabels() {
return fillProblemLabels.isSelected();
}
public void setFillProblemLabels(boolean isSelected) {
fillProblemLabels.setSelected(isSelected);
}
public boolean isBoldProblemLabels() {
return boldProblemLabels.isSelected();
}
public void setBoldProblemLabels(boolean isSelected) {
boldProblemLabels.setSelected(isSelected);
}
public boolean isItalicProblemLabels() {
return italicProblemLabels.isSelected();
}
public void setItalicProblemLabels(boolean isSelected) {
italicProblemLabels.setSelected(isSelected);
}
public boolean isShowErrors() {
return showErrors.isSelected();
}
public void setShowErrors(final boolean isSelected) {
showErrors.setSelected(isSelected);
}
public boolean isHighlightErrors() {
return highlightErrors.isSelected();
}
public void setHighlightErrors(boolean isSelected) {
highlightErrors.setSelected(isSelected);
}
public boolean isShowErrorsInGutter() {
return showErrorsInGutter.isSelected();
}
public void setShowErrorsInGutter(boolean isSelected) {
showErrorsInGutter.setSelected(isSelected);
}
public boolean isShowWarnings() {
return showWarnings.isSelected();
}
public void setShowWarnings(final boolean isSelected) {
showWarnings.setSelected(isSelected);
}
public boolean isHighlightWarnings() {
return highlightWarnings.isSelected();
}
public void setHighlightWarnings(final boolean isSelected) {
highlightWarnings.setSelected(isSelected);
}
public boolean isShowWarningsInGutter() {
return showWarningsInGutter.isSelected();
}
public void setShowWarningsInGutter(final boolean isSelected) {
showWarningsInGutter.setSelected(isSelected);
}
public boolean isShowWeakWarnings() {
return showWeakWarnings.isSelected();
}
public void setShowWeakWarnings(final boolean isSelected) {
showWeakWarnings.setSelected(isSelected);
}
public boolean isHighlightWeakWarnings() {
return highlightWeakWarnings.isSelected();
}
public void setHighlightWeakWarnings(final boolean isSelected) {
highlightWeakWarnings.setSelected(isSelected);
}
public boolean isShowWeakWarningsInGutter() {
return showWeakWarningsInGutter.isSelected();
}
public void setShowWeakWarningsInGutter(boolean isSelected) {
showWeakWarningsInGutter.setSelected(isSelected);
}
public boolean isShowInfos() {
return showInfos.isSelected();
}
public void setShowInfos(final boolean isSelected) {
showInfos.setSelected(isSelected);
}
public boolean isHighlightInfo() {
return highlightInfo.isSelected();
}
public void setHighlightInfo(final boolean isSelected) {
highlightInfo.setSelected(isSelected);
}
public boolean isShowInfosInGutter() {
return showInfosInGutter.isSelected();
}
public void setShowInfosInGutter(boolean isSelected) {
showInfosInGutter.setSelected(isSelected);
}
public Color getErrorTextColor() {
return errorTextColor.getSelectedColor();
}
public void setErrorTextColor(final Color color) {
errorTextColor.setSelectedColor(color);
}
public Color getErrorLabelBackgroundColor() {
return errorLabelBackgroundColor.getSelectedColor();
}
public void setErrorLabelBackgroundColor(final Color color) {
errorLabelBackgroundColor.setSelectedColor(color);
}
public Color getWarningTextColor() {
return warningTextColor.getSelectedColor();
}
public void setWarningTextColor(final Color color) {
warningTextColor.setSelectedColor(color);
}
public Color getWarningLabelBackgroundColor() {
return warningLabelBackgroundColor.getSelectedColor();
}
public void setWarningLabelBackgroundColor(final Color color) {
warningLabelBackgroundColor.setSelectedColor(color);
}
public Color getWeakWarningTextColor() {
return weakWarningTextColor.getSelectedColor();
}
public void setWeakWarningTextColor(final Color color) {
weakWarningTextColor.setSelectedColor(color);
}
public Color getWeakWarningLabelBackgroundColor() {
return weakWarningLabelBackgroundColor.getSelectedColor();
}
public void setWeakWarningLabelBackgroundColor(final Color color) {
weakWarningLabelBackgroundColor.setSelectedColor(color);
}
public Color getInfoTextColor() {
return infoTextColor.getSelectedColor();
}
public void setInfoTextColor(final Color color) {
infoTextColor.setSelectedColor(color);
}
public Color getInfoLabelBackgroundColor() {
return infoLabelBackgroundColor.getSelectedColor();
}
public void setInfoLabelBackgroundColor(final Color color) {
infoLabelBackgroundColor.setSelectedColor(color);
}
public Color getErrorHighlightColor() {
return errorHighlightColor.getSelectedColor();
}
public void setErrorHighlightColor(final Color color) {
errorHighlightColor.setSelectedColor(color);
}
public Color getWarningHighlightColor() {
return warningHighlightColor.getSelectedColor();
}
public void setWarningHighlightColor(final Color color) {
warningHighlightColor.setSelectedColor(color);
}
public Color getWeakWarningHighlightColor() {
return weakWarningHighlightColor.getSelectedColor();
}
public void setWeakWarningHighlightColor(final Color color) {
weakWarningHighlightColor.setSelectedColor(color);
}
public Color getInfoHighlightColor() {
return infoHighlightColor.getSelectedColor();
}
public void setInfoHighlightColor(final Color color) {
infoHighlightColor.setSelectedColor(color);
}
public String getProblemFilterList() {
return problemFilterList.getText();
}
public void setProblemFilterList(final String newText) {
problemFilterList.setText(newText);
}
public String getFileExtensionBlacklist() {
return fileExtensionBlacklist.getText();
}
public void setFileExtensionBlacklist(final String newText) {
fileExtensionBlacklist.setText(newText);
}
public String getAdditionalInfoSeverities() {
return additionalInfoSeverities.getText();
}
public List<Integer> getAdditionalInfoSeveritiesList() {
return getSeverityIntegerList(additionalInfoSeverities.getText());
}
public void setAdditionalInfoSeverities(final String newText) {
additionalInfoSeverities.setText(newText);
}
public String getAdditionalWarningSeverities() {
return additionalWarningSeverities.getText();
}
public List<Integer> getAdditionalWarningSeveritiesList() {
return getSeverityIntegerList(additionalWarningSeverities.getText());
}
public void setAdditionalWarningSeverities(final String newText) {
additionalWarningSeverities.setText(newText);
}
public String getAdditionalErrorSeverities() {
return additionalErrorSeverities.getText();
}
public List<Integer> getAdditionalErrorSeveritiesList() {
return getSeverityIntegerList(additionalErrorSeverities.getText());
}
public void setAdditionalErrorSeverities(final String newText) {
additionalErrorSeverities.setText(newText);
}
public String getAdditionalWeakWarningSeverities() {
return additionalWeakWarningSeverities.getText();
}
public List<Integer> getAdditionalWeakWarningSeveritiesList() {
return getSeverityIntegerList(additionalWeakWarningSeverities.getText());
}
public void setAdditionalWeakWarningSeverities(final String newText) {
additionalWeakWarningSeverities.setText(newText);
}
public int getEnabledListener() {
return enabledListener.getSelectedIndex();
}
public void setEnabledListener(int index) {
enabledListener.setSelectedIndex(index);
}
private List<Integer> getSeverityIntegerList(String text) {
return Arrays.stream(text.split(";"))
.map(String::trim)
.filter(s -> !s.isEmpty())
.filter(s -> {
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
})
.map(Integer::parseInt)
.collect(Collectors.toList());
}
public int getManualScannerDelay() {
try {
return Math.max(Integer.parseInt(manualScannerDelay.getText()), 10);
}
catch (NumberFormatException e) {
return 100;
}
}
public void setManualScannerDelay(int delay) {
manualScannerDelay.setText(Integer.toString(Math.max(10, delay)));
}
public int getMaxProblemsPerLine() {
try {
return Math.max(Integer.parseInt(maxProblemsPerLine.getText()), 0);
}
catch (NumberFormatException e) {
return 0;
}
}
public void setMaxProblemsPerLine(int max) {
maxProblemsPerLine.setText(Integer.toString(Math.max(0, max)));
}
public int getMaxFileLines() {
try {
return Math.max(Integer.parseInt(maxFileLines.getText()), 0);
}
catch (NumberFormatException e) {
return 0;
}
}
public void setMaxFileLines(int lines) {
maxFileLines.setText(Integer.toString(Math.max(0, lines)));
}
}