Changeset 8461 in josm
- Timestamp:
- 2015-06-03T14:05:30+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r8413 r8461 651 651 } 652 652 653 if (regexp && key.length() > 0&& !"*".equals(key)) {653 if (regexp && !key.isEmpty() && !"*".equals(key)) { 654 654 try { 655 655 keyPattern = Pattern.compile(key, regexFlags(false)); … … 662 662 keyPattern = null; 663 663 } 664 if (regexp && this.value.length() > 0&& !"*".equals(this.value)) {664 if (regexp && !this.value.isEmpty() && !"*".equals(this.value)) { 665 665 try { 666 666 valuePattern = Pattern.compile(this.value, regexFlags(false)); -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r8449 r8461 178 178 public static int askForOption(String text, String opts) { 179 179 Integer answer; 180 if ( opts.length()>0) {180 if (!opts.isEmpty()) { 181 181 String[] options = opts.split(";"); 182 182 answer = JOptionPane.showOptionDialog(Main.parent, text, "Question", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, 0); … … 189 189 public static String askForText(String text) { 190 190 String s = JOptionPane.showInputDialog(Main.parent, text, tr("Enter text"), JOptionPane.QUESTION_MESSAGE); 191 if (s!=null && (s=s.trim()).length()>0) {191 if (s!=null && !(s=s.trim()).isEmpty()) { 192 192 return s; 193 193 } else { … … 558 558 PreferencesUtils.showPrefs(tmpPref); 559 559 560 if ( id.length()>0) {560 if (!id.isEmpty()) { 561 561 try { 562 562 String fragmentVar = "API.fragments['"+id+"']"; … … 621 621 String text = evalVars(elem.getAttribute("text")); 622 622 String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text")); 623 if (locText!=null && locText.length()>0) text=locText;623 if (locText!=null && !locText.isEmpty()) text=locText; 624 624 625 625 String type = evalVars(elem.getAttribute("type")); … … 630 630 String text = evalVars(elem.getAttribute("text")); 631 631 String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text")); 632 if ( locText.length()>0) text=locText;632 if (!locText.isEmpty()) text=locText; 633 633 String var = elem.getAttribute("var"); 634 634 if (var.isEmpty()) var="result"; … … 640 640 String opts = evalVars(elem.getAttribute("options")); 641 641 String locOpts = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".options")); 642 if ( locOpts.length()>0) opts=locOpts;642 if (!locOpts.isEmpty()) opts=locOpts; 643 643 setVar(var, String.valueOf(askForOption(text, opts))); 644 644 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java
r7937 r8461 74 74 for (int i = 0; i <= 3; i++) { 75 75 String ipSegment = groups[i]; 76 if (ipSegment == null || ipSegment. length() <= 0) {76 if (ipSegment == null || ipSegment.isEmpty()) { 77 77 return false; 78 78 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r7937 r8461 405 405 406 406 String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA); 407 if (extra != null && extra.trim().length() > 0){407 if (extra != null && !extra.trim().isEmpty()){ 408 408 return false; 409 409 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r8401 r8461 301 301 })); 302 302 303 if ( key.length() > 0) {303 if (!key.isEmpty()) { 304 304 String s = marktr("Role {0} unknown in templates {1}"); 305 305 -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r8444 r8461 177 177 boolean isFirstLine = true; 178 178 String line; 179 while ((line = reader.readLine()) != null && (tagcheckerfile || line.length() != 0)) {179 while ((line = reader.readLine()) != null && (tagcheckerfile || !line.isEmpty())) { 180 180 if (line.startsWith("#")) { 181 181 if (line.startsWith("# JOSM TagChecker")) { … … 218 218 } 219 219 } else if (tagcheckerfile) { 220 if ( line.length() > 0) {220 if (!line.isEmpty()) { 221 221 CheckerData d = new CheckerData(); 222 222 String err = d.getData(line); … … 247 247 } 248 248 249 if ( errorSources.length() > 0)249 if (!errorSources.isEmpty()) 250 250 throw new IOException(tr("Could not access data file(s):\n{0}", errorSources)); 251 251 } … … 382 382 withErrors.put(p, "HTML"); 383 383 } 384 if (checkValues && key != null && value != null && value.length() > 0&& presetsValueData != null) {384 if (checkValues && key != null && value != null && !value.isEmpty() && presetsValueData != null) { 385 385 final Set<String> values = presetsValueData.get(key); 386 386 final boolean keyInPresets = values != null; … … 440 440 } 441 441 } 442 if (checkFixmes && key != null && value != null && value.length() > 0) {442 if (checkFixmes && key != null && value != null && !value.isEmpty()) { 443 443 if ((value.toLowerCase(Locale.ENGLISH).contains("fixme") 444 444 || value.contains("check and delete") -
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r8443 r8461 525 525 .append("</strong>="); 526 526 String value = tags.get(key); 527 while (value.length() != 0) {527 while (!value.isEmpty()) { 528 528 sb.append(value.substring(0,Math.min(50, value.length()))); 529 529 if (value.length() > 50) { -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r8441 r8461 492 492 493 493 // Ensure all required variables are available 494 if (rememberSizePref.length() != 0&& defaultWindowGeometry != null) {494 if (!rememberSizePref.isEmpty() && defaultWindowGeometry != null) { 495 495 if(visible) { 496 496 initWindowGeometry().applySafe(this); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
r8444 r8461 1025 1025 @Override 1026 1026 public boolean isValid() { 1027 return getComponent().getText().trim().length() > 0;1027 return !getComponent().getText().trim().isEmpty(); 1028 1028 } 1029 1029 -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r8394 r8461 305 305 306 306 protected final void updateEnabledState() { 307 setEnabled( cbSearchExpression.getText().trim().length() > 0);307 setEnabled(!cbSearchExpression.getText().trim().isEmpty()); 308 308 } 309 309 -
trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
r8444 r8461 117 117 String commentText = comment.getText(); 118 118 //closing a note creates an empty comment that we don't want to show 119 if (commentText != null && commentText.trim().length() > 0) {119 if (commentText != null && !commentText.trim().isEmpty()) { 120 120 sb.append("<hr/>"); 121 121 String userName = XmlWriter.encode(comment.getUser().getName()); -
trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
r8442 r8461 408 408 @Override 409 409 public boolean isValid() { 410 return getComponent().getText().trim().length() > 0;410 return !getComponent().getText().trim().isEmpty(); 411 411 } 412 412 … … 429 429 @Override 430 430 public boolean isValid() { 431 return getComponent().getText().trim().length() > 0;431 return !getComponent().getText().trim().isEmpty(); 432 432 } 433 433 -
trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticPropertiesPanel.java
r6890 r8461 82 82 @Override 83 83 public boolean isValid() { 84 return getComponent().getText().trim().length() > 0;84 return !getComponent().getText().trim().isEmpty(); 85 85 } 86 86 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r8444 r8461 489 489 // Get icon 490 490 String iconName = tps.getIconName(); 491 ImageIcon icon = iconName != null && iconName.length() > 0? ImageProvider.get("preferences", iconName) : null;491 ImageIcon icon = iconName != null && !iconName.isEmpty() ? ImageProvider.get("preferences", iconName) : null; 492 492 // See #6985 - Force icons to be 48x48 pixels 493 493 if (icon != null && (icon.getIconHeight() != 48 || icon.getIconWidth() != 48)) { -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r8444 r8461 218 218 skip('='); 219 219 String paramValue = readTillChar(',',')'); 220 if ( paramName.length() > 0 && paramValue.length() > 0) {220 if (!paramName.isEmpty() && !paramValue.isEmpty()) { 221 221 ActionParameter<?> actionParam = actionParams.get(paramName); 222 222 if (actionParam != null) { … … 235 235 skip('='); 236 236 String paramValue = readTillChar(',','}'); 237 if ("icon".equals(paramName) && paramValue.length() > 0) {237 if ("icon".equals(paramName) && !paramValue.isEmpty()) { 238 238 result.setIcon(paramValue); 239 } else if("name".equals(paramName) && paramValue.length() > 0) {239 } else if("name".equals(paramName) && !paramValue.isEmpty()) { 240 240 result.setName(paramValue); 241 241 } … … 289 289 boolean first = true; 290 290 String tmp = action.getName(); 291 if (tmp.length() != 0) {291 if (!tmp.isEmpty()) { 292 292 result.append(first ? "{" : ","); 293 293 result.append("name="); … … 296 296 } 297 297 tmp = action.getIcon(); 298 if (tmp.length() != 0) {298 if (!tmp.isEmpty()) { 299 299 result.append(first ? "{" : ","); 300 300 result.append("icon="); … … 385 385 ActionParameter<Object> param = getParam(paramIndex); 386 386 387 if (param != null && val.length() > 0) {387 if (param != null && !val.isEmpty()) { 388 388 currentAction.getParameters().put(param.getName(), param.readFromString((String)aValue)); 389 389 } -
trunk/src/org/openstreetmap/josm/gui/preferences/server/UserNameValidator.java
r6529 r8461 23 23 @Override 24 24 public boolean isValid() { 25 return getComponent().getText().trim().length() > 0;25 return !getComponent().getText().trim().isEmpty(); 26 26 } 27 27 -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r8441 r8461 104 104 try { 105 105 Long.parseLong(str); 106 if ( curText.length() != 0)106 if (!curText.isEmpty()) 107 107 Long.parseLong(curText); 108 108 item = lookupItem(curText, true); -
trunk/src/org/openstreetmap/josm/io/GpxExporter.java
r8443 r8461 147 147 148 148 Main.pref.put("lastAddAuthor", author.isSelected()); 149 if ( authorName.getText().length() != 0) {149 if (!authorName.getText().isEmpty()) { 150 150 Main.pref.put("lastAuthorName", authorName.getText()); 151 151 } 152 if ( copyright.getText().length() != 0) {152 if (!copyright.getText().isEmpty()) { 153 153 Main.pref.put("lastCopyright", copyright.getText()); 154 154 } … … 164 164 // add author and copyright details to the gpx data 165 165 if (author.isSelected()) { 166 if ( authorName.getText().length() > 0) {166 if (!authorName.getText().isEmpty()) { 167 167 gpxData.put(META_AUTHOR_NAME, authorName.getText()); 168 168 gpxData.put(META_COPYRIGHT_AUTHOR, authorName.getText()); 169 169 } 170 if ( email.getText().length() > 0) {170 if (!email.getText().isEmpty()) { 171 171 gpxData.put(META_AUTHOR_EMAIL, email.getText()); 172 172 } 173 if ( copyright.getText().length() > 0) {173 if (!copyright.getText().isEmpty()) { 174 174 gpxData.put(META_COPYRIGHT_LICENSE, copyright.getText()); 175 175 } 176 if ( copyrightYear.getText().length() > 0) {176 if (!copyrightYear.getText().isEmpty()) { 177 177 gpxData.put(META_COPYRIGHT_YEAR, copyrightYear.getText()); 178 178 } … … 180 180 181 181 // add the description to the gpx data 182 if ( desc.getText().length() > 0) {182 if (!desc.getText().isEmpty()) { 183 183 gpxData.put(META_DESC, desc.getText()); 184 184 } 185 185 186 186 // add keywords to the gpx data 187 if ( keywords.getText().length() > 0) {187 if (!keywords.getText().isEmpty()) { 188 188 gpxData.put(META_KEYWORDS, keywords.getText()); 189 189 } … … 271 271 email.setText(""); 272 272 } 273 boolean isAuthorSet = authorName.getText().length() != 0; 274 GpxExporter.enableCopyright(data, copyright, predefined, copyrightYear, copyrightLabel, copyrightYearLabel, warning, b && isAuthorSet); 273 boolean isAuthorSet = !authorName.getText().isEmpty(); 274 GpxExporter.enableCopyright(data, copyright, predefined, copyrightYear, copyrightLabel, copyrightYearLabel, warning, 275 b && isAuthorSet); 275 276 } 276 277 }; … … 279 280 KeyAdapter authorNameListener = new KeyAdapter(){ 280 281 @Override public void keyReleased(KeyEvent e) { 281 boolean b = authorName.getText().length()!=0&& author.isSelected();282 boolean b = !authorName.getText().isEmpty() && author.isSelected(); 282 283 GpxExporter.enableCopyright(data, copyright, predefined, copyrightYear, copyrightLabel, copyrightYearLabel, warning, b); 283 284 } -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r8390 r8461 364 364 break; 365 365 case "link": 366 if (currentLink.uri == null && accumulator != null && accumulator.toString().length() != 0) {366 if (currentLink.uri == null && accumulator != null && !accumulator.toString().isEmpty()) { 367 367 currentLink = new GpxLink(accumulator.toString()); 368 368 } -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r8449 r8461 250 250 */ 251 251 private void simpleTag(String tag, String content) { 252 if (content != null && content.length() > 0) {252 if (content != null && !content.isEmpty()) { 253 253 open(tag); 254 254 out.print(encode(content)); -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r8415 r8461 436 436 437 437 String time = parser.getAttributeValue(null, "timestamp"); 438 if (time != null && time.length() != 0) {438 if (time != null && !time.isEmpty()) { 439 439 current.setTimestamp(DateUtils.fromString(time)); 440 440 } -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r8443 r8461 147 147 String pl = Utils.join(",", Main.pref.getCollection("plugins")); 148 148 String printsite = site.replaceAll("%<(.*)>", ""); 149 if (pl != null && pl.length() != 0) {149 if (pl != null && !pl.isEmpty()) { 150 150 site = site.replaceAll("%<(.*)>", "$1"+pl); 151 151 } else { -
trunk/src/org/openstreetmap/josm/tools/ColorHelper.java
r8404 r8461 20 20 */ 21 21 public static Color html2color(String html) { 22 if ( html.length() > 0&& html.charAt(0) == '#')22 if (!html.isEmpty() && html.charAt(0) == '#') 23 23 html = html.substring(1); 24 24 if (html.length() == 3) { -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r8377 r8461 292 292 } 293 293 result += name; 294 if (sc != null && sc.getKeyText().length() != 0) {294 if (sc != null && !sc.getKeyText().isEmpty()) { 295 295 result += " "; 296 296 if (canHtml) { -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r8404 r8461 147 147 result += "<html>"; 148 148 result += name; 149 if (sc != null && sc.getKeyText().length() != 0) {149 if (sc != null && !sc.getKeyText().isEmpty()) { 150 150 result += " "; 151 151 result += "<font size='-2'>"; -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r8443 r8461 85 85 esc = true; 86 86 } else if (c == '\"' && !quotesStarted) { // opening " 87 if ( s.toString().trim().length()>0) { // we had ||some text"||87 if (!s.toString().trim().isEmpty()) { // we had ||some text"|| 88 88 s.append(c); // just add ", not open 89 89 } else {
Note:
See TracChangeset
for help on using the changeset viewer.