Changeset 18691 in josm
- Timestamp:
- 2023-03-14T14:37:10+01:00 (21 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java
r18392 r18691 169 169 170 170 /** 171 * Adds a active/edit layer change listener171 * Adds an active/edit layer change listener 172 172 * 173 173 * @param listener the listener. 174 174 */ 175 175 public synchronized void addActiveLayerChangeListener(ActiveLayerChangeListener listener) { 176 for ( int i = 0; i < activeLayerChangeListeners.size(); i++) {177 if (activeLayerChangeListener s.get(i)== listener) {176 for (ActiveLayerChangeListener activeLayerChangeListener : activeLayerChangeListeners) { 177 if (activeLayerChangeListener == listener) { 178 178 Logging.error(""); 179 179 Logging.error("Attempted to add listener that was already in list: " + listener); … … 183 183 } 184 184 activeLayerChangeListeners.add(listener); 185 } 186 187 /** 188 * Adds multiple active/edit layer change listeners. Either all listeners are added or none are added. 189 * 190 * @param listeners the listeners. 191 * @return {@code false} if the listener list did not change 192 * @since 18691 193 */ 194 public synchronized boolean addActiveLayerChangeListeners(Collection<? extends ActiveLayerChangeListener> listeners) { 195 for (ActiveLayerChangeListener activeLayerChangeListener : activeLayerChangeListeners) { 196 if (listeners.contains(activeLayerChangeListener)) { 197 Logging.error(""); 198 Logging.error("Attempted to add listener that was already in list: " + listeners); 199 showStackTrace(Thread.currentThread().getStackTrace()); 200 return false; 201 } 202 } 203 return activeLayerChangeListeners.addAll(listeners); 185 204 } 186 205 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java
r17055 r18691 18 18 import java.util.Objects; 19 19 import java.util.Set; 20 import java.util.regex.Pattern; 20 21 import java.util.stream.Collectors; 21 22 … … 62 63 private static final int CLASSIFICATION_TAGS_MATCH = 100; 63 64 65 private static final Pattern PATTERN_PUNCTUATION = Pattern.compile("\\p{Punct}", Pattern.UNICODE_CHARACTER_CLASS); 66 64 67 private static final BooleanProperty SEARCH_IN_TAGS = new BooleanProperty("taggingpreset.dialog.search-in-tags", true); 65 68 private static final BooleanProperty ONLY_APPLICABLE = new BooleanProperty("taggingpreset.dialog.only-applicable-to-selection", true); … … 136 139 137 140 private static String simplifyString(String s) { 138 return Utils.deAccent(s).toLowerCase(Locale.ENGLISH).replaceAll("\\p{Punct}","");141 return PATTERN_PUNCTUATION.matcher(Utils.deAccent(s).toLowerCase(Locale.ENGLISH)).replaceAll(""); 139 142 } 140 143 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r18363 r18691 9 9 import java.util.HashMap; 10 10 import java.util.HashSet; 11 import java.util.List; 11 12 import java.util.Map; 12 13 import java.util.Set; … … 88 89 89 90 readFromPreferences(); 91 final List<TaggingPreset> activeLayerChangeListeners = new ArrayList<>(taggingPresets.size()); 90 92 for (TaggingPreset tp: taggingPresets) { 91 93 if (!(tp instanceof TaggingPresetSeparator)) { 92 94 MainApplication.getToolbar().register(tp); 93 MainApplication.getLayerManager().addActiveLayerChangeListener(tp); 94 } 95 } 95 activeLayerChangeListeners.add(tp); 96 } 97 } 98 MainApplication.getLayerManager().addActiveLayerChangeListeners(activeLayerChangeListeners); 96 99 if (taggingPresets.isEmpty()) { 97 100 presetsMenu.setVisible(false); -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r18690 r18691 11 11 import java.io.FileInputStream; 12 12 import java.io.FileNotFoundException; 13 import java.io.FileOutputStream;14 13 import java.io.IOException; 15 14 import java.io.OutputStreamWriter; -
trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java
r18690 r18691 7 7 import java.io.ByteArrayOutputStream; 8 8 import java.io.File; 9 import java.io.FileInputStream;10 9 import java.io.IOException; 11 10 import java.io.InputStream; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r18690 r18691 23 23 import java.io.Closeable; 24 24 import java.io.File; 25 import java.io.FileInputStream;26 25 import java.io.FileOutputStream; 27 26 import java.io.IOException; -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/ClipboardUtilsTest.java
r18690 r18691 15 15 import java.awt.datatransfer.Transferable; 16 16 import java.awt.datatransfer.UnsupportedFlavorException; 17 import java.io.IOException;18 17 19 18 import net.trajano.commons.testing.UtilityClassTestUtil; -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/LayerTransferableTest.java
r18690 r18691 16 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.gui.datatransfer.LayerTransferable.Data; 18 import org.openstreetmap.josm.gui.layer.Layer;19 18 import org.openstreetmap.josm.gui.layer.LayerManagerTest; 20 19 import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer;
Note:
See TracChangeset
for help on using the changeset viewer.