48
48
import org .eclipse .php .internal .ui .wizards .fields .ListDialogField ;
49
49
import org .eclipse .php .internal .ui .wizards .fields .StringDialogField ;
50
50
import org .eclipse .swt .SWT ;
51
+ import org .eclipse .swt .events .SelectionEvent ;
52
+ import org .eclipse .swt .events .SelectionListener ;
51
53
import org .eclipse .swt .graphics .Font ;
52
54
import org .eclipse .swt .graphics .Image ;
53
55
import org .eclipse .swt .layout .GridData ;
54
56
import org .eclipse .swt .layout .GridLayout ;
57
+ import org .eclipse .swt .widgets .Combo ;
55
58
import org .eclipse .swt .widgets .Composite ;
56
59
import org .eclipse .swt .widgets .Control ;
57
60
import org .eclipse .swt .widgets .Group ;
@@ -221,8 +224,6 @@ public PHPCodeSnifferConfigurationBlock(IStatusChangeListener context, IProject
221
224
fStandardsList .setTableColumns (new ListDialogField .ColumnsDescription (data , columnsHeaders , true ));
222
225
fStandardsList .setViewerSorter (new ViewerSorter ());
223
226
224
- unpackStandards ();
225
-
226
227
if (fStandardsList .getSize () > 0 ) {
227
228
fStandardsList .selectFirstElement ();
228
229
} else {
@@ -252,9 +253,8 @@ public PHPCodeSnifferConfigurationBlock(IStatusChangeListener context, IProject
252
253
253
254
private static Key [] getKeys () {
254
255
return new Key [] { PREF_PHP_EXECUTABLE , PREF_PEAR_LIBRARY , PREF_DEBUG_PRINT_OUTPUT , PREF_CUSTOM_STANDARD_NAMES ,
255
- PREF_CUSTOM_STANDARD_PATHS , PREF_DEFAULT_STANDARD_NAME , PREF_DEFAULT_STANDARD_PATH ,
256
- PREF_ACTIVE_STANDARDS , PREF_DEFAULT_TAB_WITH , PREF_FILE_EXTENSIONS , PREF_IGNORE_PATTERN ,
257
- PREF_IGNORE_SNIFFS };
256
+ PREF_CUSTOM_STANDARD_PATHS , PREF_ACTIVE_STANDARDS , PREF_DEFAULT_TAB_WITH , PREF_FILE_EXTENSIONS ,
257
+ PREF_IGNORE_PATTERN , PREF_IGNORE_SNIFFS };
258
258
}
259
259
260
260
protected Composite createToolContents (Composite parent ) {
@@ -316,6 +316,16 @@ private Composite createStandardsTabContent(Composite folder) {
316
316
createDialogFieldsWithInfoText (folder , new DialogField [] { fIgnoreSniffs }, "Ignore Sniffs" ,
317
317
new String [] { "Sniffs are separated by a comma" });
318
318
319
+ unpackStandards (pearLibraryCombo .getText ());
320
+ pearLibraryCombo .addSelectionListener (new SelectionListener () {
321
+ public void widgetSelected (SelectionEvent e ) {
322
+ unpackStandards (((Combo ) e .widget ).getText ());
323
+ }
324
+
325
+ public void widgetDefaultSelected (SelectionEvent e ) {
326
+ }
327
+ });
328
+
319
329
return markersGroup ;
320
330
}
321
331
@@ -437,7 +447,7 @@ protected Key getPEARLibraryKey() {
437
447
*/
438
448
439
449
protected void updateControls () {
440
- unpackStandards ();
450
+ unpackStandards (pearLibraryCombo . getText () );
441
451
unpackTabWidth ();
442
452
unpackFileExtensions ();
443
453
unpackIgnorePattern ();
@@ -468,7 +478,7 @@ private void unpackIgnoreSniffs() {
468
478
fIgnoreSniffs .setText (ignoreSniffs );
469
479
}
470
480
471
- private void unpackStandards () {
481
+ private void unpackStandards (String libName ) {
472
482
String activeStandards = getValue (PREF_ACTIVE_STANDARDS );
473
483
ArrayList <String > activeList = new ArrayList <String >();
474
484
@@ -483,7 +493,7 @@ private void unpackStandards() {
483
493
484
494
String customStandardPrefs = getValue (PREF_CUSTOM_STANDARD_NAMES );
485
495
486
- String [] standards = PHPCodeSnifferPlugin .getDefault ().getCodeSnifferStandards ();
496
+ String [] standards = PHPCodeSnifferPlugin .getDefault ().getCodeSnifferStandards (libName );
487
497
String [] customStandards = {};
488
498
String [] customPaths = {};
489
499
0 commit comments