Ignore:
Timestamp:
2017-09-14T01:59:34+02:00 (3 years ago)
Author:
bastiK
Message:

see #15229 - extract "struct" handling from Preference to StructUtils

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtil.java

    r12620 r12851  
    1515import java.util.stream.Collectors;
    1616
    17 import org.openstreetmap.josm.Main;
    18 import org.openstreetmap.josm.data.Preferences.pref;
     17import org.openstreetmap.josm.data.StructUtils;
     18import org.openstreetmap.josm.data.StructUtils.StructEntry;
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2020import org.openstreetmap.josm.data.osm.Tag;
    2121import org.openstreetmap.josm.data.osm.TagCollection;
     22import org.openstreetmap.josm.spi.preferences.Config;
    2223import org.openstreetmap.josm.tools.Logging;
    2324import org.openstreetmap.josm.tools.Pair;
     
    158159    public static Collection<AutomaticTagConflictResolver> getAutomaticTagConflictResolvers() {
    159160        if (automaticTagConflictResolvers == null) {
    160             Collection<AutomaticCombine> automaticTagConflictCombines =
    161                     Main.pref.getListOfStructs(
     161            Collection<AutomaticCombine> automaticTagConflictCombines = StructUtils.getListOfStructs(
     162                            Config.getPref(),
    162163                            "automatic-tag-conflict-resolution.combine",
    163164                            defaultAutomaticTagConflictCombines, AutomaticCombine.class);
    164165            Collection<AutomaticChoiceGroup> automaticTagConflictChoiceGroups =
    165                     AutomaticChoiceGroup.groupChoices(Main.pref.getListOfStructs(
     166                    AutomaticChoiceGroup.groupChoices(StructUtils.getListOfStructs(
     167                            Config.getPref(),
    166168                            "automatic-tag-conflict-resolution.choice",
    167169                            defaultAutomaticTagConflictChoices, AutomaticChoice.class));
     
    230232
    231233        /** The Tag key to match */
    232         @pref public String key;
     234        @StructEntry public String key;
    233235
    234236        /** A free description */
    235         @pref public String description = "";
     237        @StructEntry public String description = "";
    236238
    237239        /** If regular expression must be used to match the Tag key or the value. */
    238         @pref public boolean isRegex;
     240        @StructEntry public boolean isRegex;
    239241
    240242        /** The separator to use to combine the values. */
    241         @pref public String separator = ";";
     243        @StructEntry public String separator = ";";
    242244
    243245        /** If the combined values must be sorted.
     
    249251         * </ul>
    250252         */
    251         @pref public String sort;
     253        @StructEntry public String sort;
    252254
    253255        /** Default constructor. */
     
    317319
    318320        /** The Tag key to match. */
    319         @pref public String key;
     321        @StructEntry public String key;
    320322
    321323        /** The name of the {link AutomaticChoice group} this choice belongs to. */
    322         @pref public String group;
     324        @StructEntry public String group;
    323325
    324326        /** A free description. */
    325         @pref public String description = "";
     327        @StructEntry public String description = "";
    326328
    327329        /** If regular expression must be used to match the Tag key or the value. */
    328         @pref public boolean isRegex;
     330        @StructEntry public boolean isRegex;
    329331
    330332        /** The Tag value to match. */
    331         @pref public String value;
     333        @StructEntry public String value;
    332334
    333335        /**
     
    335337         * Natural String ordering is used to identify the best score.
    336338         */
    337         @pref public String score;
     339        @StructEntry public String score;
    338340
    339341        /** Default constructor. */
     
    404406
    405407        /** The Tag key to match. */
    406         @pref public String key;
     408        @StructEntry public String key;
    407409
    408410        /** The name of the group. */
     
    410412
    411413        /** If regular expression must be used to match the Tag key. */
    412         @pref public boolean isRegex;
     414        @StructEntry public boolean isRegex;
    413415
    414416        /** The list of choice to choose from. */
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/WMSLayerExporter.java

    r12671 r12851  
    77import java.io.ObjectOutputStream;
    88
    9 import org.openstreetmap.josm.data.Preferences;
     9import org.openstreetmap.josm.data.StructUtils;
    1010import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryPreferenceEntry;
    1111import org.openstreetmap.josm.gui.MainApplication;
     
    4242                oos.writeObject(MainApplication.getMap().mapView.getCenter());
    4343                ImageryPreferenceEntry entry = new ImageryPreferenceEntry(((AbstractTileSourceLayer) layer).getInfo());
    44                 oos.writeObject(Preferences.serializeStruct(entry, ImageryPreferenceEntry.class));
     44                oos.writeObject(StructUtils.serializeStruct(entry, ImageryPreferenceEntry.class));
    4545            }
    4646        }
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/WMSLayerImporter.java

    r12671 r12851  
    1212
    1313import org.openstreetmap.josm.actions.ExtensionFileFilter;
    14 import org.openstreetmap.josm.data.Preferences;
     14import org.openstreetmap.josm.data.StructUtils;
    1515import org.openstreetmap.josm.data.coor.EastNorth;
    1616import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    7272
    7373                @SuppressWarnings("unchecked")
    74                 ImageryPreferenceEntry entry = Preferences.deserializeStruct(
     74                ImageryPreferenceEntry entry = StructUtils.deserializeStruct(
    7575                        (Map<String, String>) ois.readObject(),
    7676                        ImageryPreferenceEntry.class);
Note: See TracChangeset for help on using the changeset viewer.