Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322604

Summary: [Preferences] NPE opening preference dialog when only one preference page
Product: [Eclipse Project] Platform Reporter: Brock Janiczak <brockj>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED DUPLICATE QA Contact: Oleg Besedin <ob1.eclipse>
Severity: minor    
Priority: P3 CC: sptaszkiewicz
Version: 3.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Brock Janiczak CLA 2010-08-12 19:19:35 EDT
Build Identifier: I20100312-1448

Attempting to open a preference dialog with a dsiplayed id filter fails when there is only one preference page in the application

Reproducible: Always

Steps to Reproduce:
I have tried creating a preference dialog using both of these patterns:
PreferencesUtil.createPreferenceDialogOn(getSite().getShell(), "PreferencePage", new String[] {"PreferencePage"});
and
PreferencesUtil.createPreferenceDialogOn(getSite().getShell(), "PreferencePage", new String[] {});

It only works if i pass in null to the displayedIds field (which i don't want)

I think there needs to be a "if (hasAtMostOnePage()) {" guard in showOnly

see the below stacktrace for details:

java.lang.NullPointerException
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showOnly(FilteredPreferenceDialog.java:356)
	at org.eclipse.ui.dialogs.PreferencesUtil.applyOptions(PreferencesUtil.java:75)
	at org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(PreferencesUtil.java:194)
	at org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(PreferencesUtil.java:116)
Comment 1 Szymon Ptaszkiewicz CLA 2011-09-20 07:20:03 EDT

*** This bug has been marked as a duplicate of bug 298451 ***