Ignore:
Timestamp:
2017-11-09T00:08:01+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12859

Location:
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/OSMRecPluginHelper.java

    r33579 r33800  
    9999import org.openstreetmap.josm.data.preferences.BooleanProperty;
    100100import org.openstreetmap.josm.data.preferences.IntegerProperty;
     101import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem;
    101102import org.openstreetmap.josm.gui.ExtendedDialog;
    102103import org.openstreetmap.josm.gui.MainApplication;
    103104import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    104105import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
    105 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;
    106106import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
    107 //import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
    108107import org.openstreetmap.josm.gui.util.GuiHelper;
    109108import org.openstreetmap.josm.gui.util.WindowGeometry;
     
    172171    private String changedKey;
    173172
    174     Comparator<AutoCompletionListItem> defaultACItemComparator = new Comparator<AutoCompletionListItem>() {
     173    Comparator<AutoCompletionItem> defaultACItemComparator = new Comparator<AutoCompletionItem>() {
    175174        @Override
    176         public int compare(AutoCompletionListItem o1, AutoCompletionListItem o2) {
     175        public int compare(AutoCompletionItem o1, AutoCompletionItem o2) {
    177176            return String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue());
    178177        }
     
    195194    OSMRecPluginHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) {
    196195        this.tagData = propertyData;
    197         fileHistory = Main.pref.getCollection("file-open.history");
     196        fileHistory = Main.pref.getList("file-open.history");
    198197        if (!fileHistory.isEmpty()) {
    199198            MAIN_PATH = (String) fileHistory.toArray()[0];
     
    282281        if (PROPERTY_REMEMBER_TAGS.get() && recentTags.isEmpty()) {
    283282            recentTags.clear();
    284             Collection<String> c = Main.pref.getCollection("properties.recent-tags");
     283            Collection<String> c = Main.pref.getList("properties.recent-tags");
    285284            Iterator<String> it = c.iterator();
    286285            String key, value;
     
    303302                c.add(t.getValue());
    304303            }
    305             Main.pref.putCollection("properties.recent-tags", c);
     304            Main.pref.putList("properties.recent-tags", c);
    306305        }
    307306    }
     
    424423            daysField.setColumns(FIELD_COLUMNS);
    425424
    426             Collection<String> fileHistory = Main.pref.getCollection("file-open.history");
     425            Collection<String> fileHistory = Main.pref.getList("file-open.history");
    427426            if (!fileHistory.isEmpty()) {
    428427                inputFileField.setText(MAIN_PATH);
     
    623622            mainPanel.add(trainingProgressBar, BorderLayout.SOUTH);
    624623
    625             AutoCompletionManager autocomplete = MainApplication.getLayerManager().getEditLayer().data.getAutoCompletionManager();
    626             List<AutoCompletionListItem> keyList = autocomplete.getKeys();
     624            AutoCompletionManager autocomplete = AutoCompletionManager.of(MainApplication.getLayerManager().getEditLayer().data);
     625            List<AutoCompletionItem> keyList = new ArrayList<>(autocomplete.getTagKeys());
    627626            Collections.sort(keyList, defaultACItemComparator);
    628627
     
    964963         * @return The created adapter
    965964         */
    966         protected FocusAdapter addFocusAdapter(final AutoCompletionManager autocomplete, final Comparator<AutoCompletionListItem> comparator) {
     965        protected FocusAdapter addFocusAdapter(final AutoCompletionManager autocomplete, final Comparator<AutoCompletionItem> comparator) {
    967966            // get the combo box' editor component
    968967            JTextComponent editor = (JTextComponent) values.getEditor().getEditorComponent();
     
    973972                    String key = keys.getEditor().getItem().toString();
    974973
    975                     List<AutoCompletionListItem> valueList = autocomplete.getValues(getAutocompletionKeys(key));
     974                    List<AutoCompletionItem> valueList = new ArrayList<>(autocomplete.getTagValues(getAutocompletionKeys(key)));
    976975                    Collections.sort(valueList, comparator);
    977976
    978                     values.setPossibleACItems(valueList);
     977                    values.setPossibleAcItems(valueList);
    979978                    values.getEditor().selectAll();
    980979                }
     
    15481547            +"<br><br>"+tr("Please select a key")), GBC.eol().fill(GBC.HORIZONTAL));
    15491548
    1550             AutoCompletionManager autocomplete = MainApplication.getLayerManager().getEditLayer().data.getAutoCompletionManager();
    1551             List<AutoCompletionListItem> keyList = autocomplete.getKeys();
    1552 
    1553             AutoCompletionListItem itemToSelect = null;
     1549            AutoCompletionManager autocomplete = AutoCompletionManager.of(MainApplication.getLayerManager().getEditLayer().data);
     1550            List<AutoCompletionItem> keyList = new ArrayList<>(autocomplete.getTagKeys());
     1551
     1552            AutoCompletionItem itemToSelect = null;
    15541553            // remove the object's tag keys from the list
    1555             Iterator<AutoCompletionListItem> iter = keyList.iterator();
     1554            Iterator<AutoCompletionItem> iter = keyList.iterator();
    15561555            while (iter.hasNext()) {
    1557                 AutoCompletionListItem item = iter.next();
     1556                AutoCompletionItem item = iter.next();
    15581557                if (item.getValue().equals(lastAddKey)) {
    15591558                    itemToSelect = item;
     
    15711570
    15721571            Collections.sort(keyList, defaultACItemComparator);
    1573             keys.setPossibleACItems(keyList);
     1572            keys.setPossibleAcItems(keyList);
    15741573            keys.setEditable(true);
    15751574
     
    23632362
    23642363            try {
    2365                 input = new Scanner(textualListFile);
     2364                input = new Scanner(textualListFile, "UTF-8");
    23662365            } catch (FileNotFoundException ex) {
    23672366                Logging.warn(ex);
  • applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/parsers/Mapper.java

    r32404 r33800  
    3434    public void parseFile(InputStream inps) throws FileNotFoundException {
    3535
    36         Scanner input = new Scanner(inps); //the Map file contains lines of the mappings separated with the symbol "|"
     36        Scanner input = new Scanner(inps, "UTF-8"); //the Map file contains lines of the mappings separated with the symbol "|"
    3737        //e.g. highway motorway | Motorway
    3838        //the key will be the string "highway motorway" and the value "Motorway"
  • applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/parsers/TextualStatistics.java

    r32404 r33800  
    2323        textualList = new ArrayList<>();
    2424
    25         Scanner input = new Scanner(textualFileStream);
     25        Scanner input = new Scanner(textualFileStream, "UTF-8");
    2626        while (input.hasNext()) {
    2727            String nextLine = input.nextLine();
Note: See TracChangeset for help on using the changeset viewer.