Changeset 4656 in josm
- Timestamp:
- 2011-12-12T13:37:20+01:00 (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/preferences.xsd
r4612 r4656 11 11 <element name="collection" type="tns:collection" /> 12 12 <element name="list" type="tns:list" /> 13 <element name="lists" type="tns:lists" /> 14 <element name="maps" type="tns:maps" /> 13 15 </choice> 14 16 </sequence> … … 36 38 <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded"/> 37 39 </sequence> 40 <!-- deprecated: remove mid 2012 --> 38 41 <sequence> 39 42 <element name="list" type="tns:slist" minOccurs="0" maxOccurs="unbounded"/> 40 43 </sequence> 44 <!-- deprecated: remove mid 2012 --> 41 45 <sequence> 42 46 <element name="map" type="tns:map" minOccurs="0" maxOccurs="unbounded"/> … … 46 50 </complexType> 47 51 52 <complexType name="lists"> 53 <sequence> 54 <element name="list" type="tns:slist" minOccurs="0" maxOccurs="unbounded"/> 55 </sequence> 56 <attribute name="key" type="string" use="required" /> 57 </complexType> 58 59 <complexType name="maps"> 60 <sequence> 61 <element name="map" type="tns:map" minOccurs="0" maxOccurs="unbounded"/> 62 </sequence> 63 <attribute name="key" type="string" use="required" /> 64 </complexType> 65 48 66 <complexType name="slist"> 49 67 <sequence> -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r4635 r4656 1344 1344 } 1345 1345 public void visit(ListListSetting setting) { 1346 changed = putArray(key, (Collection) setting.getValue()); 1346 @SuppressWarnings("unchecked") 1347 boolean changed = putArray(key, (Collection) setting.getValue()); 1348 this.changed = changed; 1347 1349 } 1348 1350 public void visit(MapListSetting setting) { … … 1465 1467 properties.put(parser.getAttributeValue(null, "key"), parser.getAttributeValue(null, "value")); 1466 1468 jumpToEnd(); 1467 } else if (parser.getLocalName().equals("list") || parser.getLocalName().equals("collection")) { 1469 } else if (parser.getLocalName().equals("list") || 1470 parser.getLocalName().equals("collection") || 1471 parser.getLocalName().equals("lists") || 1472 parser.getLocalName().equals("maps") 1473 ) { 1468 1474 parseToplevelList(); 1469 1475 } else { … … 1489 1495 protected void parseToplevelList() throws XMLStreamException { 1490 1496 String key = parser.getAttributeValue(null, "key"); 1497 String name = parser.getLocalName(); 1498 1491 1499 List<String> entries = null; 1492 1500 List<List<String>> lists = null; … … 1520 1528 if (entries != null) { 1521 1529 collectionProperties.put(key, Collections.unmodifiableList(entries)); 1522 } 1523 if (lists != null) { 1530 } else if (lists != null) { 1524 1531 arrayProperties.put(key, Collections.unmodifiableList(lists)); 1525 } 1526 if (maps != null) { 1532 } else if (maps != null) { 1527 1533 listOfStructsProperties.put(key, Collections.unmodifiableList(maps)); 1534 } else { 1535 if (name.equals("lists")) { 1536 arrayProperties.put(key, Collections.<List<String>>emptyList()); 1537 } else if (name.equals("maps")) { 1538 listOfStructsProperties.put(key, Collections.<Map<String, String>>emptyList()); 1539 } else { 1540 collectionProperties.put(key, Collections.<String>emptyList()); 1541 } 1528 1542 } 1529 1543 } … … 1623 1637 1624 1638 public void visit(ListListSetting setting) { 1625 b.append(" <list key='").append(XmlWriter.encode(key)).append("'>\n");1639 b.append(" <lists key='").append(XmlWriter.encode(key)).append("'>\n"); 1626 1640 for (List<String> list : setting.getValue()) { 1627 1641 b.append(" <list>\n"); … … 1631 1645 b.append(" </list>\n"); 1632 1646 } 1633 b.append(" </list >\n");1647 b.append(" </lists>\n"); 1634 1648 } 1635 1649 1636 1650 public void visit(MapListSetting setting) { 1637 b.append(" < listkey='").append(XmlWriter.encode(key)).append("'>\n");1651 b.append(" <maps key='").append(XmlWriter.encode(key)).append("'>\n"); 1638 1652 for (Map<String, String> struct : setting.getValue()) { 1639 1653 b.append(" <map>\n"); … … 1643 1657 b.append(" </map>\n"); 1644 1658 } 1645 b.append(" </ list>\n");1659 b.append(" </maps>\n"); 1646 1660 } 1647 1661 }
Note:
See TracChangeset
for help on using the changeset viewer.