mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +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.
|
* use, to store the description of the Property set.
|
||||||
*/
|
*/
|
||||||
public interface IPropertySet {
|
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$
|
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 _name;
|
||||||
private String _label = null;
|
private String _label = null;
|
||||||
|
private String _description = null;
|
||||||
private Map _properties;
|
private Map _properties;
|
||||||
private IPropertySetContainer _container = null;
|
private IPropertySetContainer _container = null;
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, I
|
||||||
*/
|
*/
|
||||||
public PropertySet(IPropertySet propertySet) {
|
public PropertySet(IPropertySet propertySet) {
|
||||||
_name = propertySet.getName();
|
_name = propertySet.getName();
|
||||||
|
_description = propertySet.getDescription();
|
||||||
_properties = new HashMap();
|
_properties = new HashMap();
|
||||||
if (propertySet instanceof ILabeledObject) {
|
if (propertySet instanceof ILabeledObject) {
|
||||||
ILabeledObject p = (ILabeledObject) propertySet;
|
ILabeledObject p = (ILabeledObject) propertySet;
|
||||||
|
@ -84,11 +86,11 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, I
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return getPropertyValue(DESCRIPTION_KEY);
|
return _description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
addProperty(DESCRIPTION_KEY, description);
|
_description = description;
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ public abstract class PropertySetContainer extends RSEPersistableObject implemen
|
||||||
|
|
||||||
public IPropertySet createPropertySet(String name, String description) {
|
public IPropertySet createPropertySet(String name, String description) {
|
||||||
IPropertySet newSet = new PropertySet(name);
|
IPropertySet newSet = new PropertySet(name);
|
||||||
|
newSet.setDescription(description);
|
||||||
newSet.setContainer(this);
|
newSet.setContainer(this);
|
||||||
newSet.addProperty(IPropertySet.DESCRIPTION_KEY, description);
|
|
||||||
_propertySets.put(name, newSet);
|
_propertySets.put(name, newSet);
|
||||||
return 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.ISystemFilterPoolReferenceManager;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterString;
|
import org.eclipse.rse.core.filters.ISystemFilterString;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
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.IPropertySet;
|
||||||
import org.eclipse.rse.core.model.IPropertyType;
|
import org.eclipse.rse.core.model.IPropertyType;
|
||||||
import org.eclipse.rse.core.model.IRSEModelObject;
|
import org.eclipse.rse.core.model.IRSEModelObject;
|
||||||
|
@ -166,6 +167,7 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
||||||
for (int i = 0; i < propertySets.length; i++) {
|
for (int i = 0; i < propertySets.length; i++) {
|
||||||
IPropertySet set = propertySets[i];
|
IPropertySet set = propertySets[i];
|
||||||
RSEDOMNode propertySetNode = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
RSEDOMNode propertySetNode = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
||||||
|
propertySetNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, set.getDescription());
|
||||||
String[] keys = set.getPropertyKeys();
|
String[] keys = set.getPropertyKeys();
|
||||||
for (int k = 0; k < keys.length; k++) {
|
for (int k = 0; k < keys.length; k++) {
|
||||||
String key = keys[k];
|
String key = keys[k];
|
||||||
|
|
|
@ -438,14 +438,18 @@ public class RSEDOMImporter {
|
||||||
public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode) {
|
public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode) {
|
||||||
String name = propertySetNode.getName();
|
String name = propertySetNode.getName();
|
||||||
IPropertySet set = modelObject.createPropertySet(name);
|
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();
|
RSEDOMNodeAttribute[] attributes = propertySetNode.getAttributes();
|
||||||
for (int i = 0; i < attributes.length; i++) {
|
for (int i = 0; i < attributes.length; i++) {
|
||||||
RSEDOMNodeAttribute attribute = attributes[i];
|
RSEDOMNodeAttribute attribute = attributes[i];
|
||||||
|
if (attribute.getKey().equals(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION)) { // descriptions really are stored as attributes
|
||||||
|
set.setDescription(attribute.getValue());
|
||||||
|
} else {
|
||||||
String typeStr = attribute.getType();
|
String typeStr = attribute.getType();
|
||||||
IPropertyType type = PropertyType.fromString(typeStr);
|
IPropertyType type = PropertyType.fromString(typeStr);
|
||||||
set.addProperty(attribute.getKey(), attribute.getValue(), type);
|
set.addProperty(attribute.getKey(), attribute.getValue(), type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// properties are now stored as children, get those next
|
// properties are now stored as children, get those next
|
||||||
RSEDOMNode[] children = propertySetNode.getChildren();
|
RSEDOMNode[] children = propertySetNode.getChildren();
|
||||||
for (int i = 0; i < children.length; i++) {
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
@ -454,8 +458,12 @@ public class RSEDOMImporter {
|
||||||
String propertyValue = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE).getValue();
|
String propertyValue = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE).getValue();
|
||||||
String propertyTypeName = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
|
String propertyTypeName = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
|
||||||
IPropertyType propertyType = PropertyType.fromString(propertyTypeName);
|
IPropertyType propertyType = PropertyType.fromString(propertyTypeName);
|
||||||
|
if (propertyName.equals(IPropertySet.DESCRIPTION_KEY)) { // any descriptions found as properties should be set directly
|
||||||
|
set.setDescription(propertyValue);
|
||||||
|
} else {
|
||||||
set.addProperty(propertyName, propertyValue, propertyType);
|
set.addProperty(propertyName, propertyValue, propertyType);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,11 @@ public interface IRSEDOMConstants {
|
||||||
// common attributes
|
// common attributes
|
||||||
public static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
|
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_TYPE = "type"; //$NON-NLS-1$
|
||||||
|
public static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$
|
||||||
|
|
||||||
// host attributes
|
// host attributes
|
||||||
public static final String ATTRIBUTE_HOSTNAME = "hostname"; //$NON-NLS-1$
|
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_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$
|
public static final String ATTRIBUTE_SYSTEM_TYPE = "systemType"; //$NON-NLS-1$
|
||||||
|
|
||||||
// ConnectorService attributes
|
// ConnectorService attributes
|
||||||
|
|
Loading…
Add table
Reference in a new issue