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

Bug 329901

Summary: [Dialogs] new API DialogSettings#getOrCreateSection(IDialogSettings, String)
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact: Susan McCourt <susan>
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 3.7   
Target Milestone: 3.7 M4   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Markus Keller CLA 2010-11-10 08:51:53 EST
Created attachment 182811 [details]
Fix

HEAD

Many clients of IDialogSettings#getSection(String) are not interested in whether the section already exists or not. They just want that section.

Since there's no API for this on IDialogSettings, client code is full of boilerplate code like this:
    IDialogSettings section = MyPlugin.getDefault().getDialogSettings().
            getSection(sectionName);
    if (section == null) {
	section = MyPlugin.getDefault().getDialogSettings().
		addNewSection(sectionName);
    }

Since we can't change IDialogSettings any more, the best solution I see is to add this as a static method
    DialogSettings#getOrCreateSection(IDialogSettings, String)
Comment 1 Hitesh CLA 2010-11-10 12:31:14 EST
Bug 92518 might be of interest as well...
Comment 2 Dani Megert CLA 2010-11-11 09:23:09 EST
Discussed at today's Platform UI meeting. Markus, please go ahead.
Comment 3 Markus Keller CLA 2010-11-17 08:53:47 EST
Fixed in HEAD.
Comment 4 Dani Megert CLA 2010-12-07 08:13:54 EST
Verified in I20101206-1800.

Filed bug 332012  to make sure the new API gets used.