diff options
author | David Dykstal | 2007-05-26 20:15:11 +0000 |
---|---|---|
committer | David Dykstal | 2007-05-26 20:15:11 +0000 |
commit | e4a0dd7269ba0dced93bd7f0387d672b212a85e1 (patch) | |
tree | dd4d4a4392e4751cc267a32ad6f7a7108865fe4f | |
parent | 521f6a5a41e99505267f93f8d3d1f5b1cb5650a9 (diff) | |
download | org.eclipse.tm-e4a0dd7269ba0dced93bd7f0387d672b212a85e1.tar.gz org.eclipse.tm-e4a0dd7269ba0dced93bd7f0387d672b212a85e1.tar.xz org.eclipse.tm-e4a0dd7269ba0dced93bd7f0387d672b212a85e1.zip |
[189039] made property set descriptions attributes rather than properties
6 files changed, 26 insertions, 10 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 d05a1716c..f3bd8741a 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 @@ -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$ /** 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 6387aa5a0..721d69c96 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 @@ -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); } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java index b63bd716d..02d5b396b 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java @@ -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; } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java index 0dea8cdfa..f95f6bd53 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java @@ -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]; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java index 1d62acc6a..dd31ffdbe 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java @@ -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; } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java index 50bad12ee..34b35956f 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/persistence/dom/IRSEDOMConstants.java @@ -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 |