aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Herrmann2013-02-05 16:22:49 (EST)
committerPaul Webster2013-02-05 16:22:49 (EST)
commit771a38806e8efa85e0b3f46e38eab1f41a3e81ad (patch)
treeb012b621109a2019d821897685ef4be1e9d0773d
parentaec2b9fa0f49ee496f8753407c924b13021893cd (diff)
downloadeclipse.platform.ui-771a38806e8efa85e0b3f46e38eab1f41a3e81ad.zip
eclipse.platform.ui-771a38806e8efa85e0b3f46e38eab1f41a3e81ad.tar.gz
eclipse.platform.ui-771a38806e8efa85e0b3f46e38eab1f41a3e81ad.tar.bz2
Bug 92518 - [Dialogs] Removing sections from DialogSettings
-rw-r--r--bundles/org.eclipse.jface/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.jface/pom.xml2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java19
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java29
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 0756cef..f5d0ded 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 b06c3d6..2e7b5d3 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 37fac45..da55f28 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 f09deab..2f893e5 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++) {