@@ -50,8 +50,8 @@ public class PMDConfigurationForm {
5050
5151 public static final String STATISTICS_URL = "Statistics URL" ;
5252 private static final String [] columnNames = new String [] {"Option" , "Value" };
53- private static final String [] optionNames = new String [] {"Target JDK" , STATISTICS_URL };
54- private static final String [] defaultValues = new String [] {"17" , "" };
53+ private static final String [] optionNames = new String [] {"Target JDK" , STATISTICS_URL , "Threads" };
54+ private static final String [] defaultValues = new String [] {"17" , "" , "1" };
5555 private static final String STAT_URL_MSG = "Fill in Statistics URL endpoint to export anonymous PMD-Plugin usage statistics" ;
5656 private static final String STAT_URL_MSG_SUCCESS = "Could connect, will use Statistics URL endpoint to export anonymous PMD-Plugin usage statistics" ;
5757
@@ -253,9 +253,11 @@ public void setValueAt(Object aValue, int row, int column) {
253253 super .setValueAt (aValue , row , column );
254254 boolean origIsMod = isModified ;
255255 isModified = isModified || !orig .equals (aValue );
256- // row 1: statistics URL
257- if (row == 1 ) {
258- validateStatUrl ((String ) aValue , row , column , orig , origIsMod );
256+ switch (row ) {
257+ // row 1: statistics URL
258+ case 1 : validateStatUrl ((String ) aValue , row , column , orig , origIsMod );
259+ // row 2: threads
260+ case 2 : validateThreads ((String ) aValue , row , column , orig , origIsMod );
259261 }
260262 }
261263
@@ -292,6 +294,23 @@ private void validateStatUrl(String url, int row, int column, Object orig, boole
292294 }
293295 table1 .setToolTipText (statUrlMsg );
294296 }
297+
298+ private void validateThreads (String threads , int row , int column , Object orig , boolean origIsMod ) {
299+ boolean ok = true ;
300+ try {
301+ int asInt = Integer .parseInt (threads );
302+ if (asInt < 1 ) {
303+ ok = false ;
304+ }
305+ } catch (NumberFormatException ne ) {
306+ ok = false ;
307+ }
308+ if (!ok ) {
309+ super .setValueAt (orig , row , column );
310+ table1 .setToolTipText ("Must be an positive integer" );
311+ isModified = origIsMod ;
312+ }
313+ }
295314 }
296315
297316 private class MyListModel extends AbstractListModel {
0 commit comments