| Summary: | [Dialogs] Removing sections from DialogSettings | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Mykola Nikishov <mn> | ||||||
| Component: | UI | Assignee: | Paul Webster <pwebster> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P5 | CC: | markus.kell.r, pwebster, ruediger.herrmann | ||||||
| Version: | 3.5 | Keywords: | helpwanted | ||||||
| Target Milestone: | 4.3 M6 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Mykola Nikishov
Created attachment 23930 [details]
patch to remove section bug
little patch to remove section
ping What would be necessary to make this change happen? Or are there objections against the enhancement request itself? I had a quick look, IDialogSettings is API and doesn't specify @noimplement, so we can't add methods to it. But we could consider adding the method to the concrete class, DialogSettings. I'd need a re-worked patch with the new method and a test or two in http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/tests/org.eclipse.ui.tests/Eclipse%20JFace%20Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java PW Created attachment 226265 [details]
Proposed fix
Introduces method removeSection(IDialogSettings) in DialogSettings. Attempting to remove a unrelated section is ignored, passing null (implicitly) causes a NPE.
Please let me know if there is anything missing.
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=771a38806e8efa85e0b3f46e38eab1f41a3e81ad Thanx Rüdiger PW Why is the API "void removeSection(IDialogSettings)" and not like this?
public IDialogSettings removeSection(String sectionName) {
return (IDialogSettings) sections.remove(sectionName);
}
This API would also work in cases where you're not sure if the section already exists, and it even tells you whether the section existed or not.
(In reply to comment #8) > Why is the API "void removeSection(IDialogSettings)" and not like this? > > public IDialogSettings removeSection(String sectionName) { > return (IDialogSettings) sections.remove(sectionName); > } > The addNewSection took a String, but addSection takes an IDialogsSettings and the remove was the mirror of that method. But I like the above suggestion to use a String and return the removed section. Rüdiger if you have no objections I'll make the modification. PW (In reply to comment #9) > (In reply to comment #8) > > Why is the API "void removeSection(IDialogSettings)" and not like this? > > > > public IDialogSettings removeSection(String sectionName) { > > return (IDialogSettings) sections.remove(sectionName); > > } > > > > The addNewSection took a String, but addSection takes an IDialogsSettings > and the remove was the mirror of that method. But I like the above > suggestion to use a String and return the removed section. > > Rüdiger if you have no objections I'll make the modification. > > PW I like the current form for its symmetry and the client code I had in mind already holds a reference to the IDialogSettings to be removed. But, all in all, I have no real strong opinion on that matter. (In reply to comment #10) > I like the current form for its symmetry and the client code I had in mind > already holds a reference to the IDialogSettings to be removed. > But, all in all, I have no real strong opinion on that matter. How about I add the second method, and I'll add a slight rider to the current method that the DialogSettings must contain the one to be removed? PW Added the second method. http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=05f26c2cbba44a20fc68af98fe25be755732c0ff PW In 4.3.0.I20130311-2000 PW . |