From 0c5ccb71c1694f8dd784b28290cb49c4b62e313c Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Thu, 5 Apr 2007 03:02:14 +0000 Subject: [PATCH] [150931][api] added setDescription() method. --- .../org/eclipse/rse/core/model/IPropertySet.java | 12 ++++++++++-- .../org/eclipse/rse/core/model/PropertySet.java | 16 +++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java index 899e63308ca..9ea02d1b977 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySet.java @@ -44,13 +44,21 @@ public interface IPropertySet { * Return the description of this Property Set. * * Note that in order to set the description, you need to call - * setProperty(IPropertySet.DESCRIPTION_KEY, "Description"); + * addProperty(IPropertySet.DESCRIPTION_KEY, "Description"); * * @return Description of the Property Set, * or null in case no description has been set. */ public String getDescription(); - + + /** + * Sets the description property of the property set. + * Fully equivalent to + * addProperty(IPropertySet.DESCRIPTION_KEY, description); + * @param description the string describing this property set. + */ + public void setDescription(String description); + /** * Return the {@link IProperty} associated with the given key. * diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java index 0fdd2d2dbe2..9ec5136c5c8 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java @@ -17,6 +17,7 @@ package org.eclipse.rse.core.model; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -62,9 +63,12 @@ public class PropertySet implements IPropertySet { } public String getDescription() { - //FIXME it would be better to return an empty String ("") in case no description has been set. return getPropertyValue(DESCRIPTION_KEY); } + + public void setDescription(String description) { + addProperty(DESCRIPTION_KEY, description); + } public String[] getPropertyKeys() { Set set = _properties.keySet(); @@ -77,10 +81,12 @@ public class PropertySet implements IPropertySet { } public void setProperties(Map map) { - //FIXME should clone the map!! - //Since the extrnal map might not be writable, or it might be - //modified later on - _properties = map; + _properties = new HashMap(map.size()); + for (Iterator z = map.keySet().iterator(); z.hasNext();) { + String key = (String) z.next(); + Object value = map.get(key); + _properties.put(key, value); + } } /**