Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322604 - [Preferences] NPE opening preference dialog when only one preference page
Summary: [Preferences] NPE opening preference dialog when only one preference page
Status: CLOSED DUPLICATE of bug 298451
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Oleg Besedin CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-12 19:19 EDT by Brock Janiczak CLA
Modified: 2011-09-20 07:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***