mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 22:25:25 +02:00
[150931][api] added setDescription() method.
This commit is contained in:
parent
c1fd138673
commit
0c5ccb71c1
2 changed files with 21 additions and 7 deletions
|
@ -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
|
||||
* <code>setProperty(IPropertySet.DESCRIPTION_KEY, "Description");</code>
|
||||
* <code>addProperty(IPropertySet.DESCRIPTION_KEY, "Description");</code>
|
||||
*
|
||||
* @return Description of the Property Set,
|
||||
* or <code>null</code> in case no description has been set.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue