Changeset 14306 in josm for trunk


Ignore:
Timestamp:
2018-10-08T01:00:47+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16816 - new option to show object version in lists, similar to object ID

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java

    r13766 r14306  
    113113
    114114    /**
    115      * Decorates the name of primitive with its id, if the preference
    116      * <code>osm-primitives.showid</code> is set. Shows unique id if osm-primitives.showid.new-primitives is set
    117      *
    118      * @param name  the name without the id
     115     * Decorates the name of primitive with its id and version, if the preferences
     116     * <code>osm-primitives.showid</code> and <code>osm-primitives.showversion</code> are set.
     117     * Shows unique id if <code>osm-primitives.showid.new-primitives</code> is set
     118     *
     119     * @param name the name without the id
    119120     * @param primitive the primitive
    120121     */
    121122    protected void decorateNameWithId(StringBuilder name, IPrimitive primitive) {
    122123        if (Config.getPref().getBoolean("osm-primitives.showid")) {
    123             if (Config.getPref().getBoolean("osm-primitives.showid.new-primitives")) {
    124                 name.append(tr(" [id: {0}]", primitive.getUniqueId()));
     124            long id = Config.getPref().getBoolean("osm-primitives.showid.new-primitives") ?
     125                    primitive.getUniqueId() : primitive.getId();
     126            if (Config.getPref().getBoolean("osm-primitives.showversion")) {
     127                name.append(tr(" [id: {0}, v{1}]", id, primitive.getVersion()));
    125128            } else {
    126                 name.append(tr(" [id: {0}]", primitive.getId()));
    127             }
     129                name.append(tr(" [id: {0}]", id));
     130            }
     131        } else if (Config.getPref().getBoolean("osm-primitives.showversion")) {
     132            name.append(tr(" [v{0}]", primitive.getVersion()));
    128133        }
    129134    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r14138 r14306  
    8282    private final JCheckBox showSplashScreen = new JCheckBox(tr("Show splash screen at startup"));
    8383    private final JCheckBox showID = new JCheckBox(tr("Show object ID in selection lists"));
     84    private final JCheckBox showVersion = new JCheckBox(tr("Show object version in selection lists"));
    8485    private final JCheckBox showCoor = new JCheckBox(tr("Show node coordinates in selection lists"));
    8586    private final JCheckBox showLocalizedName = new JCheckBox(tr("Show localized name in selection lists"));
     
    133134        showID.setSelected(Config.getPref().getBoolean("osm-primitives.showid", false));
    134135
     136        // Show version in selection
     137        showVersion.setToolTipText(tr("Show object version in selection lists"));
     138        showVersion.setSelected(Config.getPref().getBoolean("osm-primitives.showversion", false));
     139
    135140        // Show Coordinates in selection
    136141        showCoor.setToolTipText(tr("Show node coordinates in selection lists"));
     
    147152
    148153        panel.add(showID, GBC.eop().insets(20, 0, 0, 0));
     154        panel.add(showVersion, GBC.eop().insets(20, 0, 0, 0));
    149155        panel.add(showCoor, GBC.eop().insets(20, 0, 0, 0));
    150156        panel.add(showLocalizedName, GBC.eop().insets(20, 0, 0, 0));
     
    211217        Config.getPref().putBoolean("draw.splashscreen", showSplashScreen.isSelected());
    212218        Config.getPref().putBoolean("osm-primitives.showid", showID.isSelected());
     219        Config.getPref().putBoolean("osm-primitives.showversion", showVersion.isSelected());
    213220        Config.getPref().putBoolean("osm-primitives.showcoor", showCoor.isSelected());
    214221        Config.getPref().putBoolean("osm-primitives.localize-name", showLocalizedName.isSelected());
Note: See TracChangeset for help on using the changeset viewer.