Changeset 18258 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2021-10-08T13:42:59+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompTextField.java
r18221 r18258 38 38 private boolean autocompleteEnabled = true; 39 39 /** a filter to enforce max. text length */ 40 private MaxLengthDocumentFilter docFilter;40 private transient MaxLengthDocumentFilter docFilter; 41 41 /** the model */ 42 42 protected AutoCompComboBoxModel<E> model; … … 203 203 * @param l the autoComp listener to be removed 204 204 */ 205 public synchronized void removeActionListener(AutoCompListener l) { 206 if ((l != null) && (getAction() == l)) { 207 setAction(null); 208 } else { 209 listenerList.remove(AutoCompListener.class, l); 210 } 205 public synchronized void removeAutoCompListener(AutoCompListener l) { 206 listenerList.remove(AutoCompListener.class, l); 211 207 } 212 208 … … 245 241 ((AutoCompListener) listeners[i + 1]).autoCompBefore(e); 246 242 break; 243 default: 244 break; 247 245 } 248 246 } … … 261 259 @Override 262 260 public void keyTyped(KeyEvent e) { 263 if (autocompleteEnabled) { 264 // if selection is at the end 265 if (getSelectionEnd() == getText().length()) { 266 final String oldText = getText().substring(0, getSelectionStart()); 267 // We got the event before the editor component could see it. Let the editor do its job first. 268 SwingUtilities.invokeLater(() -> autocomplete(oldText)); 269 } 261 // if selection is at the end 262 if (autocompleteEnabled && getSelectionEnd() == getText().length()) { 263 final String oldText = getText().substring(0, getSelectionStart()); 264 // We got the event before the editor component could see it. Let the editor do its job first. 265 SwingUtilities.invokeLater(() -> autocomplete(oldText)); 270 266 } 271 267 } … … 273 269 @Override 274 270 public void keyPressed(KeyEvent e) { 271 // not interested 275 272 } 276 273 277 274 @Override 278 275 public void keyReleased(KeyEvent e) { 276 // not interested 279 277 } 280 278 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r18221 r18258 43 43 * Display OSM keys as {@linkplain org.openstreetmap.josm.gui.widgets.OsmIdTextField#setHint hint} 44 44 */ 45 protected static BooleanProperty DISPLAY_KEYS_AS_HINT = new BooleanProperty("taggingpreset.display-keys-as-hint", true);45 protected static final BooleanProperty DISPLAY_KEYS_AS_HINT = new BooleanProperty("taggingpreset.display-keys-as-hint", true); 46 46 47 47 protected void initAutoCompletionField(AutoCompletingTextField field, String... key) { … … 97 97 */ 98 98 public Boolean matches(Map<String, String> tags) { 99 return null; 99 return null; // NOSONAR 100 100 } 101 101 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r17651 r18258 53 53 * Sort presets menu alphabetically 54 54 */ 55 public static BooleanProperty SORT_MENU = new BooleanProperty("taggingpreset.sortvalues", true);55 public static final BooleanProperty SORT_MENU = new BooleanProperty("taggingpreset.sortvalues", true); 56 56 /** 57 57 * Custom icon sources -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r18257 r18258 260 260 private List<String> checkListsSameLength(List<String> a, List<String> b, String name) { 261 261 if (a != null && a.size() != b.size()) { 262 Logging.error(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''{2} List'' must be the same as in ''values''",262 Logging.error(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''{2}'' must be the same as in ''values''", 263 263 key, text, name)); 264 264 Logging.error(tr("Detailed information: {0} <> {1}", a, b)); … … 292 292 List<String> shortDescriptionsList = splitEscaped(delimiter, short_descriptions); 293 293 294 displayList = checkListsSameLength(displayList, valueList, "display ");295 localeDisplayList = checkListsSameLength(localeDisplayList, valueList, "locale Display");296 shortDescriptionsList = checkListsSameLength(shortDescriptionsList, valueList, "short Descriptions");297 localeShortDescriptionsList = checkListsSameLength(localeShortDescriptionsList, valueList, "locale ShortDescriptions");294 displayList = checkListsSameLength(displayList, valueList, "display_values"); 295 localeDisplayList = checkListsSameLength(localeDisplayList, valueList, "locale_display_values"); 296 shortDescriptionsList = checkListsSameLength(shortDescriptionsList, valueList, "short_descriptions"); 297 localeShortDescriptionsList = checkListsSameLength(localeShortDescriptionsList, valueList, "locale_short_descriptions"); 298 298 299 299 for (int i = 0; i < valueList.size(); i++) { -
trunk/src/org/openstreetmap/josm/gui/widgets/OrientationAction.java
r18221 r18258 35 35 public class OrientationAction extends AbstractAction implements PropertyChangeListener { 36 36 /** Default for {@link #RTL_LANGUAGES} */ 37 p ublic static final List<String> DEFAULT_RTL_LANGUAGES = Arrays.asList("ar", "he", "fa", "iw", "ur", "lld");37 private static final List<String> DEFAULT_RTL_LANGUAGES = Arrays.asList("ar", "he", "fa", "iw", "ur"); 38 38 39 39 /** Default for {@link #LOCALIZED_KEYS} */ 40 p ublicstatic final List<String> DEFAULT_LOCALIZED_KEYS = Arrays.asList(40 private static final List<String> DEFAULT_LOCALIZED_KEYS = Arrays.asList( 41 41 "(\\p{Alnum}+_)?name", "addr", "description", "fixme", "note", "source", "strapline", "operator"); 42 42 … … 57 57 58 58 private static final Pattern LANG_PATTERN = Pattern.compile(":([a-z]{2,3})$"); 59 private static final String NEW_STATE = "newState"; 59 60 60 61 private Component component; 61 62 private ImageIcon iconRTL; 62 63 private ImageIcon iconLTR; 63 protected static Set<String> RTLLanguages = new HashSet<>(RTL_LANGUAGES.get());64 protected static Pattern localizedKeys = compile_localized_keys();64 protected static final Set<String> RTLLanguages = new HashSet<>(RTL_LANGUAGES.get()); 65 protected static final Pattern localizedKeys = compileLocalizedKeys(); 65 66 66 67 /** … … 84 85 @Override 85 86 public void actionPerformed(ActionEvent e) { 86 firePropertyChange("orientationAction", null, getValue( "newState"));87 firePropertyChange("orientationAction", null, getValue(NEW_STATE)); 87 88 } 88 89 … … 95 96 putValue(Action.SMALL_ICON, iconRTL); 96 97 putValue(Action.SHORT_DESCRIPTION, tr("Switch the text orientation to Right-to-Left.")); 97 putValue( "newState", ComponentOrientation.RIGHT_TO_LEFT);98 putValue(NEW_STATE, ComponentOrientation.RIGHT_TO_LEFT); 98 99 } else { 99 100 putValue(Action.NAME, tr("Left to Right")); 100 101 putValue(Action.SMALL_ICON, iconLTR); 101 102 putValue(Action.SHORT_DESCRIPTION, tr("Switch the text orientation to Left-to-Right.")); 102 putValue( "newState", ComponentOrientation.LEFT_TO_RIGHT);103 putValue(NEW_STATE, ComponentOrientation.LEFT_TO_RIGHT); 103 104 } 104 105 } … … 206 207 } 207 208 208 private static Pattern compile _localized_keys() {209 private static Pattern compileLocalizedKeys() { 209 210 return Pattern.compile("^(" + String.join("|", LOCALIZED_KEYS.get()) + ")$"); 210 211 }
Note:
See TracChangeset
for help on using the changeset viewer.