diff options
| author | RĂ¼diger Herrmann | 2013-02-05 21:22:49 +0000 |
|---|---|---|
| committer | Paul Webster | 2013-02-05 21:22:49 +0000 |
| commit | 771a38806e8efa85e0b3f46e38eab1f41a3e81ad (patch) | |
| tree | b012b621109a2019d821897685ef4be1e9d0773d | |
| parent | aec2b9fa0f49ee496f8753407c924b13021893cd (diff) | |
| download | eclipse.platform.ui-771a38806e8efa85e0b3f46e38eab1f41a3e81ad.tar.gz eclipse.platform.ui-771a38806e8efa85e0b3f46e38eab1f41a3e81ad.tar.xz eclipse.platform.ui-771a38806e8efa85e0b3f46e38eab1f41a3e81ad.zip | |
Bug 92518 - [Dialogs] Removing sections from DialogSettings
4 files changed, 46 insertions, 6 deletions
diff --git a/bundles/org.eclipse.jface/META-INF/MANIFEST.MF b/bundles/org.eclipse.jface/META-INF/MANIFEST.MF index 0756cef504f..f5d0ded8cdd 100644 --- a/bundles/org.eclipse.jface/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.jface/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jface -Bundle-Version: 3.8.300.qualifier +Bundle-Version: 3.9.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.jface/pom.xml b/bundles/org.eclipse.jface/pom.xml index b06c3d618c2..2e7b5d34d1f 100644 --- a/bundles/org.eclipse.jface/pom.xml +++ b/bundles/org.eclipse.jface/pom.xml @@ -21,7 +21,7 @@ </parent> <groupId>eclipse.platform.ui</groupId> <artifactId>org.eclipse.jface</artifactId> - <version>3.8.300-SNAPSHOT</version> + <version>3.9.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> <plugins> 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 37fac45fc84..da55f28153e 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation * Marc R. Hoffmann <hoffmann@mountainminds.com> - Bug 284265 [JFace] * DialogSettings.save() silently ignores IOException + * Ruediger Herrmann <ruediger.herrmann@gmx.de> - bug 92518 *******************************************************************************/ package org.eclipse.jface.dialogs; @@ -120,14 +121,25 @@ public class DialogSettings implements IDialogSettings { return section; } - /* (non-Javadoc) + /* (non-Javadoc) * Method declared on IDialogSettings. */ public void addSection(IDialogSettings section) { sections.put(section.getName(), section); } - /* (non-Javadoc) + /** + * 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 + */ + public void removeSection(IDialogSettings section) { + sections.remove(section.getName()); + } + + /* (non-Javadoc) * Method declared on IDialogSettings. */ public String get(String key) { @@ -591,4 +603,5 @@ public class DialogSettings implements IDialogSettings { return null; } } + } diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java index f09deab0249..2f893e5da32 100644 --- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -151,6 +151,33 @@ public class DialogSettingsTest extends TestCase { } }); } + + public void testRemoveSection() { + DialogSettings dialogSettings = new DialogSettings(null); + IDialogSettings section = dialogSettings.addNewSection("new-section"); + + dialogSettings.removeSection(section); + + assertEquals(0, dialogSettings.getSections().length); + } + + public void testRemoveNonExistingSection() { + DialogSettings dialogSettings = new DialogSettings(null); + IDialogSettings otherSection = new DialogSettings(null); + + dialogSettings.removeSection(otherSection); + + assertEquals(0, dialogSettings.getSections().length); + } + + public void testRemoveSectionWithNullArgument() { + DialogSettings dialogSettings = new DialogSettings(null); + + try { + dialogSettings.removeSection(null); + } catch (NullPointerException expected) { + } + } public void testKeys() throws IOException { for (int i = 0; i < TEST_STRINGS.length; i++) { |
