Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14864 closed enhancement (wontfix)

[PATCH] Add a new preference to remember changeset tags, and include them by default in all changesets

Reported by: rorym Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: tags, changeset, upload Cc:

Description (last modified by Don-vip)

I suggest adding a new preference upload.changeset.tags.additional, a list of Strings, which will be the additional tags that will be added to every changeset by default. This patch enables this feature. It applies clearly on r12285 (current HEAD), and I have tested it when submitting changesets to OSM.org.

There are suggested changeset tags, and this patch makes it easy to "remember" a set of changeset tags by putting them in your preferences. Otherwise you have to enter the changeset tags all the time.

I hope this is merged, but am open to discussion.

  • src/org/openstreetmap/josm/gui/io/UploadDialog.java

     
    1616import java.beans.PropertyChangeEvent;
    1717import java.beans.PropertyChangeListener;
    1818import java.lang.Character.UnicodeBlock;
     19import java.util.Arrays;
    1920import java.util.ArrayList;
    2021import java.util.Collection;
    2122import java.util.Collections;
     
    269270    /**
    270271     * Sets the tags for this upload based on (later items overwrite earlier ones):
    271272     * <ul>
     273     * <li>From the upload.changeset.tags.additional prefence</li>
    272274     * <li>previous "source" and "comment" input</li>
    273275     * <li>the tags set in the dataset (see {@link DataSet#getChangeSetTags()})</li>
    274276     * <li>the tags from the selected open changeset</li>
     
    280282    public void setChangesetTags(DataSet dataSet) {
    281283        final Map<String, String> tags = new HashMap<>();
    282284
     285        // From preferences
     286        // TODO is there a better way to read this, as a Map, rather than List/Collection?
     287        Collection<String> tags_from_prefs = Main.pref.getCollection("upload.changeset.tags.additional", Arrays.asList(new String[] {}));
     288        for (Iterator<String> iterator = tags_from_prefs.iterator(); iterator.hasNext();) {
     289            tags.put(iterator.next(), iterator.next());
     290        }
     291
    283292        // obtain from previous input
    284293        tags.put("source", getLastChangesetSourceFromHistory());
    285294        tags.put("comment", getLastChangesetCommentFromHistory());

Attachments (0)

Change History (6)

comment:1 by Don-vip, 7 years ago

Description: modified (diff)

comment:2 by bastiK, 7 years ago

Resolution: wontfix
Status: newclosed

Rorym, thanks for the patch! I'm not in favor of applying the patch, because it is essential a new feature that is only accessible by Einstein settings. It means we have to maintain non-trivial code that is known to and used by a very small group of people (possibly just you).

Most typical use of advanced preferences is to make a hard-coded value configurable, but your patch does a bit more than that.

comment:3 by rorym, 7 years ago

Rats! :(

This change was partially motivated by the fact that JOSM doesn't remember changeset tags between changesets. So if you want to add an extra tags you need to do it manually. I would be happy with JOSM remembering the previously entered changeset tags and automatically using them.

The reason I want to do it is to put things in the clacks.

in reply to:  3 ; comment:4 by stoecker, 7 years ago

Replying to rorym:

Rats! :(

This change was partially motivated by the fact that JOSM doesn't remember changeset tags between changesets. So if you want to add an extra tags you need to do it manually. I would be happy with JOSM remembering the previously entered changeset tags and automatically using them.

I also see no reason to integrate this. But you can make a plugin for this purpose ;-)

The reason I want to do it is to put things in the clacks.

Well, JOSM website does not forget to handle the overhead properly. You are not alone.

Last edited 7 years ago by stoecker (previous) (diff)

in reply to:  4 comment:5 by stoecker, 7 years ago

The reason I want to do it is to put things in the clacks.

Well, JOSM website does not forget to handle the overhead properly. You are not alone.

BTW: There are people out there, which simply install all available plugins, even a possible pterry.jar :-)

comment:6 by rorym, 7 years ago

I have made a more general patch in #15464

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.