Changeset 8846 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-10-10T01:40:42+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ColorHelper.java
r8510 r8846 63 63 if (col == null) 64 64 return null; 65 String code = "#"+int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue());65 String code = '#'+int2hex(col.getRed())+int2hex(col.getGreen())+int2hex(col.getBlue()); 66 66 if (withAlpha) { 67 67 int alpha = col.getAlpha(); -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r8836 r8846 267 267 if (header != null) { 268 268 if (body != null && !header.equals(body)) { 269 msg = header + " (" + body + ")";269 msg = header + " (" + body + ')'; 270 270 } else { 271 271 msg = header; -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r8840 r8846 309 309 } 310 310 if (strings != null) { 311 String trans = strings.get(ctx == null ? text : "_:"+ctx+ "\n"+text);311 String trans = strings.get(ctx == null ? text : "_:"+ctx+'\n'+text); 312 312 if (trans != null) 313 313 return trans; … … 315 315 if (pstrings != null) { 316 316 i = pluralEval(1); 317 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+ "\n"+text);317 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+'\n'+text); 318 318 if (trans != null && trans.length > i) 319 319 return trans[i]; … … 339 339 if (pstrings != null) { 340 340 i = pluralEval(num); 341 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+ "\n"+text);341 String[] trans = pstrings.get(ctx == null ? text : "_:"+ctx+'\n'+text); 342 342 if (trans != null && trans.length > i) 343 343 return trans[i]; … … 353 353 354 354 private static URL getTranslationFile(String lang) { 355 return Main.class.getResource("/data/"+lang.replace( "@", "-")+".lang");355 return Main.class.getResource("/data/"+lang.replace('@', '-')+".lang"); 356 356 } 357 357 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r8840 r8846 720 720 subdir = ""; 721 721 } else if (!subdir.isEmpty() && !subdir.endsWith("/")) { 722 subdir += "/";722 subdir += '/'; 723 723 } 724 724 String[] extensions; … … 742 742 /* cache separately */ 743 743 if (dirs != null && !dirs.isEmpty()) { 744 cacheName = "id:" + id + ":"+ fullName;744 cacheName = "id:" + id + ':' + fullName; 745 745 if (archive != null) { 746 cacheName += ":"+ archive.getName();746 cacheName += ':' + archive.getName(); 747 747 } 748 748 } … … 838 838 bytes = Utils.decodeUrl(data).getBytes(StandardCharsets.UTF_8); 839 839 } catch (IllegalArgumentException ex) { 840 Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")");840 Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ')'); 841 841 return null; 842 842 } … … 898 898 } else { 899 899 final String fn_md5 = Utils.md5Hex(fn); 900 url = b + fn_md5.substring(0, 1) + "/"+ fn_md5.substring(0, 2) + "/" + fn;900 url = b + fn_md5.substring(0, 1) + '/' + fn_md5.substring(0, 2) + "/" + fn; 901 901 } 902 902 result = getIfAvailableHttp(url, type); … … 922 922 inArchiveDir = ""; 923 923 } else if (!inArchiveDir.isEmpty()) { 924 inArchiveDir += "/";924 inArchiveDir += '/'; 925 925 } 926 926 String entryName = inArchiveDir + fullName; … … 1142 1142 } 1143 1143 if (GraphicsEnvironment.isHeadless()) { 1144 Main.warn("Cursors are not available in headless mode. Returning null for '"+name+ "'");1144 Main.warn("Cursors are not available in headless mode. Returning null for '"+name+'\''); 1145 1145 return null; 1146 1146 } -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r8510 r8846 54 54 } else if (code.matches(".+@.+")) { 55 55 return code.substring(0, 1).toUpperCase(Locale.ENGLISH) + code.substring(1, 2) 56 + "-" + code.substring(3, 4).toUpperCase(Locale.ENGLISH) + code.substring(4) + ":";57 } 58 return code.substring(0, 1).toUpperCase(Locale.ENGLISH) + code.substring(1) + ":";56 + '-' + code.substring(3, 4).toUpperCase(Locale.ENGLISH) + code.substring(4) + ':'; 57 } 58 return code.substring(0, 1).toUpperCase(Locale.ENGLISH) + code.substring(1) + ':'; 59 59 } 60 60 … … 156 156 */ 157 157 public static Locale getLocale(String localeName) { 158 int country = localeName.indexOf( "_");159 int variant = localeName.indexOf( "@");158 int country = localeName.indexOf('_'); 159 int variant = localeName.indexOf('@'); 160 160 if (variant < 0 && country >= 0) 161 variant = localeName.indexOf( "_", country+1);161 variant = localeName.indexOf('_', country+1); 162 162 Locale l; 163 163 if (variant > 0 && country > 0) { … … 198 198 public static String getLanguageCodeXML() { 199 199 String code = getJOSMLocaleCode(); 200 code = code.replace( "@", "-");201 return code+ ".";200 code = code.replace('@', '-'); 201 return code+'.'; 202 202 } 203 203 … … 210 210 public static String getLanguageCodeManifest() { 211 211 String code = getJOSMLocaleCode(); 212 code = code.replace( "@", "-");213 return code+ "_";212 code = code.replace('@', '-'); 213 return code+'_'; 214 214 } 215 215 … … 239 239 if (v != null && !v.isEmpty()) { 240 240 if (c != null) 241 list.add(lang+ "_"+c+"@"+v);242 list.add(lang+ "@"+v);241 list.add(lang+'_'+c+'@'+v); 242 list.add(lang+'@'+v); 243 243 } 244 244 if (c != null) 245 list.add(lang+ "_"+c);245 list.add(lang+'_'+c); 246 246 list.add(lang); 247 247 return list; -
trunk/src/org/openstreetmap/josm/tools/MultiMap.java
r8510 r8846 232 232 List<String> entries = new ArrayList<>(map.size()); 233 233 for (Entry<A, Set<B>> entry : map.entrySet()) { 234 entries.add(entry.getKey() + "->{" + Utils.join(",", entry.getValue()) + "}");235 } 236 return "(" + Utils.join(",", entries) + ")";234 entries.add(entry.getKey() + "->{" + Utils.join(",", entry.getValue()) + '}'); 235 } 236 return '(' + Utils.join(",", entries) + ')'; 237 237 } 238 238 } -
trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java
r8510 r8846 209 209 210 210 private String formatMenuText(KeyStroke keyStroke, String index, String description) { 211 String shortcutText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()) + "+"212 + KeyEvent.getKeyText(keyStroke.getKeyCode()) + ","+ index;211 String shortcutText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()) + '+' 212 + KeyEvent.getKeyText(keyStroke.getKeyCode()) + ',' + index; 213 213 214 214 return "<html><i>" + shortcutText + "</i> " + description; -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r8510 r8846 118 118 if (map.containsKey(key)) 119 119 return Double.parseDouble(map.get(key)); 120 return Double.parseDouble(map.get( "m"+key));120 return Double.parseDouble(map.get('m'+key)); 121 121 } 122 122 … … 296 296 double lon = Math.round(dlon * decimals); 297 297 lon /= decimals; 298 return Main.getOSMWebsite() + "/#map="+zoom+ "/"+lat+"/"+lon;298 return Main.getOSMWebsite() + "/#map="+zoom+'/'+lat+'/'+lon; 299 299 } 300 300 } -
trunk/src/org/openstreetmap/josm/tools/Pair.java
r8510 r8846 64 64 @Override 65 65 public String toString() { 66 return "<"+a+ ","+b+">";66 return "<"+a+','+b+'>'; 67 67 } 68 68 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r8510 r8846 295 295 result += name; 296 296 if (sc != null && !sc.getKeyText().isEmpty()) { 297 result += " ";297 result += ' '; 298 298 if (canHtml) { 299 299 result += "<font size='-2'>"; 300 300 } 301 result += "("+sc.getKeyText()+")";301 result += '('+sc.getKeyText()+')'; 302 302 if (canHtml) { 303 303 result += "</font>"; … … 323 323 @Override 324 324 public String getOSDescription() { 325 return System.getProperty("os.name") + " "+ System.getProperty("os.version");325 return System.getProperty("os.name") + ' ' + System.getProperty("os.version"); 326 326 } 327 327 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r8540 r8846 153 153 result += name; 154 154 if (sc != null && !sc.getKeyText().isEmpty()) { 155 result += " ";155 result += ' '; 156 156 result += "<font size='-2'>"; 157 result += "("+sc.getKeyText()+")";157 result += '('+sc.getKeyText()+')'; 158 158 result += "</font>"; 159 159 } … … 210 210 String version = Utils.execOutput(Arrays.asList(args)); 211 211 if (version != null && !version.contains("not installed")) { 212 return packageName + ":"+ version;212 return packageName + ':' + version; 213 213 } 214 214 } … … 336 336 @Override public String toString() { 337 337 return "ReleaseInfo [path=" + path + ", descriptionField=" + descriptionField + 338 ", idField=" + idField + ", releaseField=" + releaseField + "]";338 ", idField=" + idField + ", releaseField=" + releaseField + ']'; 339 339 } 340 340 … … 372 372 // If no description has been found, try to rebuild it with "id" + "release" (i.e. "name" + "version") 373 373 if (result == null && id != null && release != null) { 374 result = id + " "+ release;374 result = id + ' ' + release; 375 375 } 376 376 } catch (IOException e) { … … 533 533 Main.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value); 534 534 } 535 w.append(key + "=" + value + "\n");535 w.append(key + '=' + value + '\n'); 536 536 } 537 537 w.append('\n'); … … 540 540 continue; 541 541 } 542 String key = "filename." + entry.name.replace( " ", "_");542 String key = "filename." + entry.name.replace(' ', '_'); 543 543 String value = entry.file; 544 544 String prevValue = props.getProperty(key); … … 546 546 Main.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value); 547 547 } 548 w.append(key + "=" + value + "\n");548 w.append(key + '=' + value + '\n'); 549 549 } 550 550 w.append('\n'); 551 551 String fallback = props.getProperty("sequence.fallback"); 552 552 if (fallback != null) { 553 w.append("sequence.fallback=" + fallback + "," + Utils.join(",", allCharSubsets) + "\n");553 w.append("sequence.fallback=" + fallback + ',' + Utils.join(",", allCharSubsets) + '\n'); 554 554 } else { 555 w.append("sequence.fallback=" + Utils.join(",", allCharSubsets) + "\n");555 w.append("sequence.fallback=" + Utils.join(",", allCharSubsets) + '\n'); 556 556 } 557 557 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r8510 r8846 187 187 @Override 188 188 public String getOSDescription() { 189 return Utils.strip(System.getProperty("os.name")) + " "+189 return Utils.strip(System.getProperty("os.name")) + ' ' + 190 190 ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit"; 191 191 } -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r8840 r8846 240 240 String modifText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()); 241 241 if ("".equals(modifText)) return KeyEvent.getKeyText(keyStroke.getKeyCode()); 242 return modifText + "+"+ KeyEvent.getKeyText(keyStroke.getKeyCode());242 return modifText + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode()); 243 243 } 244 244 -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r8840 r8846 258 258 String value = entry.getValue(); 259 259 if (key.length() > MAX_KEY_LENGTH) { 260 r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+ "="+value, "tags.paste.keytoolong");260 r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+'='+value, "tags.paste.keytoolong"); 261 261 if (r == 2 || r == 3) return false; if (r == 4) return true; 262 262 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r8795 r8846 1208 1208 final List<String> lines = Arrays.asList(s.split("\\n")); 1209 1209 if (lines.size() > maxLines) { 1210 return join("\n", lines.subList(0, maxLines - 1)) + "\n " + "...";1210 return join("\n", lines.subList(0, maxLines - 1)) + "\n..."; 1211 1211 } else { 1212 1212 return s; … … 1341 1341 String old = System.setProperty(key, value); 1342 1342 if (!key.toLowerCase(Locale.ENGLISH).contains("password")) { 1343 Main.debug("System property '" + key + "' set to '" + value + "'. Old value was '" + old + "'");1343 Main.debug("System property '" + key + "' set to '" + value + "'. Old value was '" + old + '\''); 1344 1344 } else { 1345 1345 Main.debug("System property '" + key + "' changed."); … … 1397 1397 String name = filename.toLowerCase(Locale.ENGLISH); 1398 1398 for (String ext : extensions) { 1399 if (name.endsWith( "."+ ext.toLowerCase(Locale.ENGLISH)))1399 if (name.endsWith('.' + ext.toLowerCase(Locale.ENGLISH))) 1400 1400 return true; 1401 1401 } -
trunk/src/org/openstreetmap/josm/tools/WikiReader.java
r8510 r8846 144 144 b += line.replaceAll("<img ", "<img border=\"0\" ") 145 145 .replaceAll("<span class=\"icon\">.</span>", "") 146 .replaceAll("href=\"/", "href=\"" + baseurl + "/")146 .replaceAll("href=\"/", "href=\"" + baseurl + '/') 147 147 .replaceAll(" />", ">") 148 + "\n";148 + '\n'; 149 149 } else if (transl && line.contains("</div>")) { 150 150 transl = false; -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r8510 r8846 474 474 @Override 475 475 public String toString() { 476 return "WindowGeometry{topLeft="+topLeft+",extent="+extent+ "}";476 return "WindowGeometry{topLeft="+topLeft+",extent="+extent+'}'; 477 477 } 478 478 } -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r8840 r8846 133 133 if ("class".equals(fieldName) || "default".equals(fieldName) || "throw".equals(fieldName) || 134 134 "new".equals(fieldName) || "null".equals(fieldName)) { 135 fieldName += "_";135 fieldName += '_'; 136 136 } 137 137 try { -
trunk/src/org/openstreetmap/josm/tools/XmlParsingException.java
r8375 r8846 61 61 msg = getClass().getName(); 62 62 } 63 return msg + " "+ tr("(at line {0}, column {1})", lineNumber, columnNumber);63 return msg + ' ' + tr("(at line {0}, column {1})", lineNumber, columnNumber); 64 64 } 65 65 -
trunk/src/org/openstreetmap/josm/tools/template_engine/SearchExpressionCondition.java
r8376 r8846 26 26 @Override 27 27 public String toString() { 28 return condition.toString() + " '" + text + "'";28 return condition.toString() + " '" + text + '\''; 29 29 } 30 30 } -
trunk/src/org/openstreetmap/josm/tools/template_engine/Tokenizer.java
r8510 r8846 3 3 4 4 import java.util.Arrays; 5 import java.util.List; 5 import java.util.HashSet; 6 import java.util.Set; 6 7 7 8 public class Tokenizer { … … 36 37 @Override 37 38 public String toString() { 38 return type + (text != null ? " "+ text : "");39 return type + (text != null ? ' ' + text : ""); 39 40 } 40 41 } … … 42 43 public enum TokenType { CONDITION_START, VARIABLE_START, CONTEXT_SWITCH_START, END, PIPE, APOSTROPHE, TEXT, EOF } 43 44 44 private final List<Character> specialCharaters = Arrays.asList(new Character[] {'$', '?', '{', '}', '|', '\'', '!'});45 private final Set<Character> specialCharaters = new HashSet<>(Arrays.asList(new Character[] {'$', '?', '{', '}', '|', '\'', '!'})); 45 46 46 47 private final String template; -
trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java
r8404 r8846 56 56 @Override 57 57 public String toString() { 58 return "{" + variableName + "}";58 return '{' + variableName + '}'; 59 59 } 60 60
Note:
See TracChangeset
for help on using the changeset viewer.