1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 18:15:23 +02:00

[150931][api] added setDescription() method.

This commit is contained in:
David Dykstal 2007-04-05 03:02:14 +00:00
parent c1fd138673
commit 0c5ccb71c1
2 changed files with 21 additions and 7 deletions

View file

@ -44,13 +44,21 @@ public interface IPropertySet {
* Return the description of this Property Set. * Return the description of this Property Set.
* *
* Note that in order to set the description, you need to call * Note that in order to set the description, you need to call
* <code>setProperty(IPropertySet.DESCRIPTION_KEY, "Description");</code> * <code>addProperty(IPropertySet.DESCRIPTION_KEY, "Description");</code>
* *
* @return Description of the Property Set, * @return Description of the Property Set,
* or <code>null</code> in case no description has been set. * or <code>null</code> in case no description has been set.
*/ */
public String getDescription(); public String getDescription();
/**
* Sets the description property of the property set.
* Fully equivalent to
* <code>addProperty(IPropertySet.DESCRIPTION_KEY, description);</code>
* @param description the string describing this property set.
*/
public void setDescription(String description);
/** /**
* Return the {@link IProperty} associated with the given key. * Return the {@link IProperty} associated with the given key.
* *

View file

@ -17,6 +17,7 @@
package org.eclipse.rse.core.model; package org.eclipse.rse.core.model;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -62,10 +63,13 @@ public class PropertySet implements IPropertySet {
} }
public String getDescription() { public String getDescription() {
//FIXME it would be better to return an empty String ("") in case no description has been set.
return getPropertyValue(DESCRIPTION_KEY); return getPropertyValue(DESCRIPTION_KEY);
} }
public void setDescription(String description) {
addProperty(DESCRIPTION_KEY, description);
}
public String[] getPropertyKeys() { public String[] getPropertyKeys() {
Set set = _properties.keySet(); Set set = _properties.keySet();
@ -77,10 +81,12 @@ public class PropertySet implements IPropertySet {
} }
public void setProperties(Map map) { public void setProperties(Map map) {
//FIXME should clone the map!! _properties = new HashMap(map.size());
//Since the extrnal map might not be writable, or it might be for (Iterator z = map.keySet().iterator(); z.hasNext();) {
//modified later on String key = (String) z.next();
_properties = map; Object value = map.get(key);
_properties.put(key, value);
}
} }
/** /**