Changeset 33800 in osm for applications/editors/josm/plugins/OSMRecPlugin/src/org
- Timestamp:
- 2017-11-09T00:08:01+01:00 (7 years ago)
- 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 99 99 import org.openstreetmap.josm.data.preferences.BooleanProperty; 100 100 import org.openstreetmap.josm.data.preferences.IntegerProperty; 101 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem; 101 102 import org.openstreetmap.josm.gui.ExtendedDialog; 102 103 import org.openstreetmap.josm.gui.MainApplication; 103 104 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 104 105 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 105 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;106 106 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 107 //import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;108 107 import org.openstreetmap.josm.gui.util.GuiHelper; 109 108 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 172 171 private String changedKey; 173 172 174 Comparator<AutoCompletion ListItem> defaultACItemComparator = new Comparator<AutoCompletionListItem>() {173 Comparator<AutoCompletionItem> defaultACItemComparator = new Comparator<AutoCompletionItem>() { 175 174 @Override 176 public int compare(AutoCompletion ListItem o1, AutoCompletionListItem o2) {175 public int compare(AutoCompletionItem o1, AutoCompletionItem o2) { 177 176 return String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue()); 178 177 } … … 195 194 OSMRecPluginHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { 196 195 this.tagData = propertyData; 197 fileHistory = Main.pref.get Collection("file-open.history");196 fileHistory = Main.pref.getList("file-open.history"); 198 197 if (!fileHistory.isEmpty()) { 199 198 MAIN_PATH = (String) fileHistory.toArray()[0]; … … 282 281 if (PROPERTY_REMEMBER_TAGS.get() && recentTags.isEmpty()) { 283 282 recentTags.clear(); 284 Collection<String> c = Main.pref.get Collection("properties.recent-tags");283 Collection<String> c = Main.pref.getList("properties.recent-tags"); 285 284 Iterator<String> it = c.iterator(); 286 285 String key, value; … … 303 302 c.add(t.getValue()); 304 303 } 305 Main.pref.put Collection("properties.recent-tags", c);304 Main.pref.putList("properties.recent-tags", c); 306 305 } 307 306 } … … 424 423 daysField.setColumns(FIELD_COLUMNS); 425 424 426 Collection<String> fileHistory = Main.pref.get Collection("file-open.history");425 Collection<String> fileHistory = Main.pref.getList("file-open.history"); 427 426 if (!fileHistory.isEmpty()) { 428 427 inputFileField.setText(MAIN_PATH); … … 623 622 mainPanel.add(trainingProgressBar, BorderLayout.SOUTH); 624 623 625 AutoCompletionManager autocomplete = MainApplication.getLayerManager().getEditLayer().data.getAutoCompletionManager();626 List<AutoCompletion ListItem> keyList = autocomplete.getKeys();624 AutoCompletionManager autocomplete = AutoCompletionManager.of(MainApplication.getLayerManager().getEditLayer().data); 625 List<AutoCompletionItem> keyList = new ArrayList<>(autocomplete.getTagKeys()); 627 626 Collections.sort(keyList, defaultACItemComparator); 628 627 … … 964 963 * @return The created adapter 965 964 */ 966 protected FocusAdapter addFocusAdapter(final AutoCompletionManager autocomplete, final Comparator<AutoCompletion ListItem> comparator) {965 protected FocusAdapter addFocusAdapter(final AutoCompletionManager autocomplete, final Comparator<AutoCompletionItem> comparator) { 967 966 // get the combo box' editor component 968 967 JTextComponent editor = (JTextComponent) values.getEditor().getEditorComponent(); … … 973 972 String key = keys.getEditor().getItem().toString(); 974 973 975 List<AutoCompletion ListItem> valueList = autocomplete.getValues(getAutocompletionKeys(key));974 List<AutoCompletionItem> valueList = new ArrayList<>(autocomplete.getTagValues(getAutocompletionKeys(key))); 976 975 Collections.sort(valueList, comparator); 977 976 978 values.setPossibleA CItems(valueList);977 values.setPossibleAcItems(valueList); 979 978 values.getEditor().selectAll(); 980 979 } … … 1548 1547 +"<br><br>"+tr("Please select a key")), GBC.eol().fill(GBC.HORIZONTAL)); 1549 1548 1550 AutoCompletionManager autocomplete = MainApplication.getLayerManager().getEditLayer().data.getAutoCompletionManager();1551 List<AutoCompletion ListItem> keyList = autocomplete.getKeys();1552 1553 AutoCompletion ListItem itemToSelect = null;1549 AutoCompletionManager autocomplete = AutoCompletionManager.of(MainApplication.getLayerManager().getEditLayer().data); 1550 List<AutoCompletionItem> keyList = new ArrayList<>(autocomplete.getTagKeys()); 1551 1552 AutoCompletionItem itemToSelect = null; 1554 1553 // remove the object's tag keys from the list 1555 Iterator<AutoCompletion ListItem> iter = keyList.iterator();1554 Iterator<AutoCompletionItem> iter = keyList.iterator(); 1556 1555 while (iter.hasNext()) { 1557 AutoCompletion ListItem item = iter.next();1556 AutoCompletionItem item = iter.next(); 1558 1557 if (item.getValue().equals(lastAddKey)) { 1559 1558 itemToSelect = item; … … 1571 1570 1572 1571 Collections.sort(keyList, defaultACItemComparator); 1573 keys.setPossibleA CItems(keyList);1572 keys.setPossibleAcItems(keyList); 1574 1573 keys.setEditable(true); 1575 1574 … … 2363 2362 2364 2363 try { 2365 input = new Scanner(textualListFile );2364 input = new Scanner(textualListFile, "UTF-8"); 2366 2365 } catch (FileNotFoundException ex) { 2367 2366 Logging.warn(ex); -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/parsers/Mapper.java
r32404 r33800 34 34 public void parseFile(InputStream inps) throws FileNotFoundException { 35 35 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 "|" 37 37 //e.g. highway motorway | Motorway 38 38 //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 23 23 textualList = new ArrayList<>(); 24 24 25 Scanner input = new Scanner(textualFileStream );25 Scanner input = new Scanner(textualFileStream, "UTF-8"); 26 26 while (input.hasNext()) { 27 27 String nextLine = input.nextLine();
Note:
See TracChangeset
for help on using the changeset viewer.