mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
[189039] made property set descriptions attributes rather than properties
This commit is contained in:
parent
521f6a5a41
commit
e4a0dd7269
6 changed files with 26 additions and 10 deletions
|
@ -31,7 +31,11 @@ import java.util.Map;
|
|||
* use, to store the description of the Property set.
|
||||
*/
|
||||
public interface IPropertySet {
|
||||
/** The key used to store the description of the Property Set. */
|
||||
/**
|
||||
* The key used to store the description of the Property Set.
|
||||
* This is no longer used and should not be referenced except for
|
||||
* compatibility reasons.
|
||||
*/
|
||||
public static final String DESCRIPTION_KEY = "description"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,7 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, I
|
|||
|
||||
private String _name;
|
||||
private String _label = null;
|
||||
private String _description = null;
|
||||
private Map _properties;
|
||||
private IPropertySetContainer _container = null;
|
||||
|
||||
|
@ -44,6 +45,7 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, I
|
|||
*/
|
||||
public PropertySet(IPropertySet propertySet) {
|
||||
_name = propertySet.getName();
|
||||
_description = propertySet.getDescription();
|
||||
_properties = new HashMap();
|
||||
if (propertySet instanceof ILabeledObject) {
|
||||
ILabeledObject p = (ILabeledObject) propertySet;
|
||||
|
@ -84,11 +86,11 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, I
|
|||
}
|
||||
|
||||
public String getDescription() {
|
||||
return getPropertyValue(DESCRIPTION_KEY);
|
||||
return _description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
addProperty(DESCRIPTION_KEY, description);
|
||||
_description = description;
|
||||
setDirty(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ public abstract class PropertySetContainer extends RSEPersistableObject implemen
|
|||
|
||||
public IPropertySet createPropertySet(String name, String description) {
|
||||
IPropertySet newSet = new PropertySet(name);
|
||||
newSet.setDescription(description);
|
||||
newSet.setContainer(this);
|
||||
newSet.addProperty(IPropertySet.DESCRIPTION_KEY, description);
|
||||
_propertySets.put(name, newSet);
|
||||
return newSet;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
|
|||
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterString;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.IProperty;
|
||||
import org.eclipse.rse.core.model.IPropertySet;
|
||||
import org.eclipse.rse.core.model.IPropertyType;
|
||||
import org.eclipse.rse.core.model.IRSEModelObject;
|
||||
|
@ -166,6 +167,7 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
|||
for (int i = 0; i < propertySets.length; i++) {
|
||||
IPropertySet set = propertySets[i];
|
||||
RSEDOMNode propertySetNode = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
||||
propertySetNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, set.getDescription());
|
||||
String[] keys = set.getPropertyKeys();
|
||||
for (int k = 0; k < keys.length; k++) {
|
||||
String key = keys[k];
|
||||
|
|
|
@ -438,13 +438,17 @@ public class RSEDOMImporter {
|
|||
public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode) {
|
||||
String name = propertySetNode.getName();
|
||||
IPropertySet set = modelObject.createPropertySet(name);
|
||||
// properties used to be stored as attributes, get those first for compatability
|
||||
// properties used to be stored as attributes, get those first for compatibility
|
||||
RSEDOMNodeAttribute[] attributes = propertySetNode.getAttributes();
|
||||
for (int i = 0; i < attributes.length; i++) {
|
||||
RSEDOMNodeAttribute attribute = attributes[i];
|
||||
String typeStr = attribute.getType();
|
||||
IPropertyType type = PropertyType.fromString(typeStr);
|
||||
set.addProperty(attribute.getKey(), attribute.getValue(), type);
|
||||
if (attribute.getKey().equals(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION)) { // descriptions really are stored as attributes
|
||||
set.setDescription(attribute.getValue());
|
||||
} else {
|
||||
String typeStr = attribute.getType();
|
||||
IPropertyType type = PropertyType.fromString(typeStr);
|
||||
set.addProperty(attribute.getKey(), attribute.getValue(), type);
|
||||
}
|
||||
}
|
||||
// properties are now stored as children, get those next
|
||||
RSEDOMNode[] children = propertySetNode.getChildren();
|
||||
|
@ -454,7 +458,11 @@ public class RSEDOMImporter {
|
|||
String propertyValue = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE).getValue();
|
||||
String propertyTypeName = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
|
||||
IPropertyType propertyType = PropertyType.fromString(propertyTypeName);
|
||||
set.addProperty(propertyName, propertyValue, propertyType);
|
||||
if (propertyName.equals(IPropertySet.DESCRIPTION_KEY)) { // any descriptions found as properties should be set directly
|
||||
set.setDescription(propertyValue);
|
||||
} else {
|
||||
set.addProperty(propertyName, propertyValue, propertyType);
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
|
|
@ -42,11 +42,11 @@ public interface IRSEDOMConstants {
|
|||
// common attributes
|
||||
public static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_TYPE = "type"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$
|
||||
|
||||
// host attributes
|
||||
public static final String ATTRIBUTE_HOSTNAME = "hostname"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_OFFLINE = "offline"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_SYSTEM_TYPE = "systemType"; //$NON-NLS-1$
|
||||
|
||||
// ConnectorService attributes
|
||||
|
|
Loading…
Add table
Reference in a new issue