Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329901 - [Dialogs] new API DialogSettings#getOrCreateSection(IDialogSettings, String)
Summary: [Dialogs] new API DialogSettings#getOrCreateSection(IDialogSettings, String)
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Markus Keller CLA
QA Contact: Susan McCourt CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-10 08:51 EST by Markus Keller CLA
Modified: 2010-12-07 08:13 EST (History)
1 user (show)

See Also:


Attachments
Fix (3.42 KB, patch)
2010-11-10 08:51 EST, Markus Keller CLA
no flags Details | Diff

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