diff options
author | Paul Webster | 2013-02-06 18:13:32 +0000 |
---|---|---|
committer | Paul Webster | 2013-02-06 18:13:32 +0000 |
commit | 05f26c2cbba44a20fc68af98fe25be755732c0ff (patch) | |
tree | d24986c1a10c8636b2adfff9b2cb2dc16b4907ad /bundles/org.eclipse.jface | |
parent | c4c9477eccf52509c329373352e67cbabaa71477 (diff) | |
download | eclipse.platform.ui-05f26c2cbba44a20fc68af98fe25be755732c0ff.tar.gz eclipse.platform.ui-05f26c2cbba44a20fc68af98fe25be755732c0ff.tar.xz eclipse.platform.ui-05f26c2cbba44a20fc68af98fe25be755732c0ff.zip |
Bug 92518 - [Dialogs] Removing sections from DialogSettings
Add the ability to remove the section by name.
Diffstat (limited to 'bundles/org.eclipse.jface')
-rw-r--r-- | bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java index da55f28153e..381ab94165a 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java @@ -129,14 +129,30 @@ public class DialogSettings implements IDialogSettings { } /** - * Remove a section in the receiver. If the given section does not exist, nothing is done. + * Remove a section in the receiver. If the given section does not exist, + * nothing is done. * * @param section - * the section to be removed - * @since 3.9 + * the section to be removed. Must not be <code>null</code>. + * @since 3.9 */ public void removeSection(IDialogSettings section) { - sections.remove(section.getName()); + if (sections.get(section.getName()) == section) { + sections.remove(section.getName()); + } + } + + /** + * Remove a section by name in the receiver. If the given section does not + * exist, nothing is done. + * + * @param sectionName + * the name of the section to be removed. Must not be <code>null</code>. + * @return The dialog section removed, or <code>null</code> if it wasn't there. + * @since 3.9 + */ + public IDialogSettings removeSection(String sectionName) { + return (IDialogSettings) sections.remove(sectionName); } /* (non-Javadoc) |