Changeset 7024 in josm for trunk/src/org
- Timestamp:
- 2014-04-29T02:38:59+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r7005 r7024 477 477 relations.size(), relations.size(), DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(relations)) 478 478 + "</html>")); 479 boolean answer =ConditionalOptionPaneUtil.showConfirmationDialog(479 return ConditionalOptionPaneUtil.showConfirmationDialog( 480 480 "delete_relations", 481 481 Main.parent, … … 485 485 JOptionPane.QUESTION_MESSAGE, 486 486 JOptionPane.YES_OPTION); 487 return answer;488 487 } 489 488 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r7005 r7024 320 320 PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand(); 321 321 final OsmDataLayer currentLayer = Main.main.getEditLayer(); 322 FilteredCollection<OsmPrimitive> prims =new FilteredCollection<>(322 return new FilteredCollection<>( 323 323 c.getParticipatingPrimitives(), 324 324 new Predicate<OsmPrimitive>(){ … … 330 330 } 331 331 ); 332 return prims;333 332 } 334 333 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r7005 r7024 1420 1420 }; 1421 1421 1422 int ret =HelpAwareOptionPane.showOptionDialog(1422 return HelpAwareOptionPane.showOptionDialog( 1423 1423 Main.parent, 1424 1424 tr("<html>The relation has been changed.<br>" … … 1432 1432 "/Dialog/RelationEditor#DiscardChanges" 1433 1433 ); 1434 return ret;1435 1434 } 1436 1435 } -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r7005 r7024 121 121 } 122 122 123 /*boolean debug = true;*/124 125 123 public interface TileLoaderFactory { 126 124 OsmTileLoader makeTileLoader(TileLoaderListener listener); … … 170 168 Main.map.repaint(100); 171 169 tileRequestsOutstanding.remove(tile); 172 /*if (debug) {170 if (Main.isDebugEnabled()) { 173 171 Main.debug("tileLoadingFinished() tile: " + tile + " success: " + success); 174 } */172 } 175 173 } 176 174 … … 639 637 } 640 638 })); 641 // end of adding menu commands642 639 643 640 final MouseAdapter adapter = new MouseAdapter() { … … 677 674 678 675 void zoomChanged() { 679 /*if (debug) {676 if (Main.isDebugEnabled()) { 680 677 Main.debug("zoomChanged(): " + currentZoomLevel); 681 } */678 } 682 679 needRedraw = true; 683 680 JobDispatcher.getInstance().cancelOutstandingJobs(); … … 703 700 public boolean zoomIncreaseAllowed() { 704 701 boolean zia = currentZoomLevel < this.getMaxZoomLvl(); 705 /*if (debug) {702 if (Main.isDebugEnabled()) { 706 703 Main.debug("zoomIncreaseAllowed(): " + zia + " " + currentZoomLevel + " vs. " + this.getMaxZoomLvl() ); 707 } */704 } 708 705 return zia; 709 706 } … … 712 709 if (zoomIncreaseAllowed()) { 713 710 currentZoomLevel++; 714 /*if (debug) {711 if (Main.isDebugEnabled()) { 715 712 Main.debug("increasing zoom level to: " + currentZoomLevel); 716 } */713 } 717 714 zoomChanged(); 718 715 } else { … … 750 747 //int minZoom = this.getMinZoomLvl(); 751 748 if (zoomDecreaseAllowed()) { 752 /*if (debug) {749 if (Main.isDebugEnabled()) { 753 750 Main.debug("decreasing zoom level to: " + currentZoomLevel); 754 } */751 } 755 752 currentZoomLevel--; 756 753 zoomChanged(); … … 847 844 boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0); 848 845 needRedraw = true; 849 /*if (debug) {846 if (Main.isDebugEnabled()) { 850 847 Main.debug("imageUpdate() done: " + done + " calling repaint"); 851 } */848 } 852 849 Main.map.repaint(done ? 0 : 100); 853 850 return !done; … … 911 908 if (border != null) { 912 909 target = source.intersection(border); 913 /*if (debug) {910 if (Main.isDebugEnabled()) { 914 911 Main.debug("source: " + source + "\nborder: " + border + "\nintersection: " + target); 915 } */912 } 916 913 } 917 914 … … 938 935 int img_y_end = img_y_offset + (int)(target.getHeight() * imageYScaling); 939 936 940 /*if (debug) {937 if (Main.isDebugEnabled()) { 941 938 Main.debug("drawing image into target rect: " + target); 942 } */939 } 943 940 g.drawImage(sourceImg, 944 941 target.x, target.y, … … 980 977 Image img = getLoadedTileImage(tile); 981 978 if (img == null || tile.hasError()) { 982 /*if (debug) {979 if (Main.isDebugEnabled()) { 983 980 Main.debug("missed tile: " + tile); 984 } */981 } 985 982 missedTiles.add(tile); 986 983 continue; … … 991 988 } 992 989 drawImageInside(g, img, sourceRect, borderRect); 993 } // end of for990 } 994 991 return missedTiles; 995 992 } … … 1017 1014 texty += 1 + fontHeight; 1018 1015 } 1019 }*/ // end of if draw debug1016 }*/ 1020 1017 1021 1018 if (tile == showMetadataTile) { … … 1399 1396 missedTiles = newlyMissedTiles; 1400 1397 } 1401 /*if (debug&& missedTiles.size() > 0) {1398 if (Main.isDebugEnabled() && missedTiles.size() > 0) { 1402 1399 Main.debug("still missed "+missedTiles.size()+" in the end"); 1403 } */1400 } 1404 1401 g.setColor(Color.red); 1405 1402 g.setFont(InfoFont); … … 1427 1424 myDrawString(g, tr("No tiles at this zoom level"), 120, 120); 1428 1425 } 1429 /*if (debug) {1426 if (Main.isDebugEnabled()) { 1430 1427 myDrawString(g, tr("Current zoom: {0}", currentZoomLevel), 50, 140); 1431 1428 myDrawString(g, tr("Display zoom: {0}", displayZoomLevel), 50, 155); 1432 1429 myDrawString(g, tr("Pixel scale: {0}", getScaleFactor(currentZoomLevel)), 50, 170); 1433 1430 myDrawString(g, tr("Best zoom: {0}", Math.log(getScaleFactor(1))/Math.log(2)/2+1), 50, 185); 1434 } */1431 } 1435 1432 } 1436 1433 … … 1440 1437 */ 1441 1438 Tile getTileForPixelpos(int px, int py) { 1442 /*if (debug) {1439 if (Main.isDebugEnabled()) { 1443 1440 Main.debug("getTileForPixelpos("+px+", "+py+")"); 1444 } */1441 } 1445 1442 MapView mv = Main.map.mapView; 1446 1443 Point clicked = new Point(px, py); … … 1458 1455 Rectangle r = new Rectangle(pixelPos(t1)); 1459 1456 r.add(pixelPos(t2)); 1460 /*if (debug) {1457 if (Main.isDebugEnabled()) { 1461 1458 Main.debug("r: " + r + " clicked: " + clicked); 1462 } */1459 } 1463 1460 if (!r.contains(clicked)) { 1464 1461 continue; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r6986 r7024 242 242 @Override 243 243 public String toString() { 244 String result =file.getName()+": "+244 return file.getName()+": "+ 245 245 "pos = "+pos+" | "+ 246 246 "exifCoor = "+exifCoor+" | "+ 247 247 (tmp == null ? " tmp==null" : 248 248 " [tmp] pos = "+tmp.pos); 249 return result;250 249 } 251 250 -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r7005 r7024 1363 1363 if (value == null) 1364 1364 return this; 1365 SourceEntry se = (SourceEntry) value; 1366 JLabel label = (JLabel)super.getTableCellRendererComponent(table, 1367 fromSourceEntry(se), isSelected, hasFocus, row, column); 1368 return label; 1365 return super.getTableCellRendererComponent(table, 1366 fromSourceEntry((SourceEntry) value), isSelected, hasFocus, row, column); 1369 1367 } 1370 1368 -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r7005 r7024 502 502 } 503 503 504 SequenceCommand command =new SequenceCommand(504 return new SequenceCommand( 505 505 trn("Remove old keys from up to {0} object", "Remove old keys from up to {0} objects", primitives.size(), primitives.size()), 506 506 commands 507 507 ); 508 509 return command;510 508 } 511 509 -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r7005 r7024 50 50 public static String explainOsmApiInitializationException(OsmApiInitializationException e) { 51 51 Main.error(e); 52 String msg =tr(52 return tr( 53 53 "<html>Failed to initialize communication with the OSM server {0}.<br>" 54 54 + "Check the server URL in your preferences and your internet connection.", 55 55 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)); 56 return msg;57 56 } 58 57 … … 65 64 public static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) { 66 65 Main.error(e); 67 String msg =tr(66 return tr( 68 67 "<html>Failed to authenticate at the OSM server ''{0}''.<br>" 69 68 + "You are using OAuth to authenticate but currently there is no<br>" … … 73 72 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL) 74 73 ); 75 return msg;76 74 } 77 75 … … 411 409 */ 412 410 public static String explainChangesetClosedException(ChangesetClosedException e) { 413 String msg;414 411 SimpleDateFormat dateFormat = new SimpleDateFormat(); 415 msg = tr( 412 Main.error(e); 413 return tr( 416 414 "<html>Failed to upload to changeset <strong>{0}</strong><br>" 417 415 +"because it has already been closed on {1}.", … … 419 417 e.getClosedOn() == null ? "?" : dateFormat.format(e.getClosedOn()) 420 418 ); 421 Main.error(e);422 return msg;423 419 } 424 420 … … 454 450 } 455 451 456 String message =tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''<br>"452 return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''<br>" 457 453 + "for security reasons. This is most likely because you are running<br>" 458 454 + "in an applet and because you did not load your applet from ''{1}''.", apiUrl, host); 459 return message;460 455 } 461 456 … … 467 462 * @param e the exception 468 463 */ 469 470 464 public static String explainNestedSocketException(OsmTransferException e) { 471 String apiUrl = e.getUrl(); 472 String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 473 + "Please check your internet connection.", apiUrl); 474 Main.error(e); 475 return message; 465 Main.error(e); 466 return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 467 + "Please check your internet connection.", e.getUrl()); 476 468 } 477 469 … … 483 475 * @param e the exception 484 476 */ 485 486 477 public static String explainNestedIOException(OsmTransferException e) { 487 478 IOException ioe = getNestedException(e, IOException.class); 488 String apiUrl = e.getUrl();489 String message =tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>"479 Main.error(e); 480 return tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>" 490 481 + "due to a problem with transferring data.<br>" 491 + "Details (untranslated): {1}</html>", apiUrl, ioe482 + "Details (untranslated): {1}</html>", e.getUrl(), ioe 492 483 .getMessage()); 493 Main.error(e);494 return message;495 484 } 496 485 … … 503 492 public static String explainNestedIllegalDataException(OsmTransferException e) { 504 493 IllegalDataException ide = getNestedException(e, IllegalDataException.class); 505 String message = tr("<html>Failed to download data. " 494 Main.error(e); 495 return tr("<html>Failed to download data. " 506 496 + "Its format is either unsupported, ill-formed, and/or inconsistent.<br>" 507 497 + "<br>Details (untranslated): {0}</html>", ide.getMessage()); 508 Main.error(e);509 return message;510 498 } 511 499 … … 516 504 * @param e the exception 517 505 */ 518 519 506 public static String explainInternalServerError(OsmTransferException e) { 520 String apiUrl = e.getUrl(); 521 String message = tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>" 522 + "This is most likely a temporary problem. Please try again later.", apiUrl); 523 Main.error(e); 524 return message; 507 Main.error(e); 508 return tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>" 509 + "This is most likely a temporary problem. Please try again later.", e.getUrl()); 525 510 } 526 511 … … 543 528 message += tr("<br>Error message(untranslated): {0}", e.getErrorHeader()); 544 529 } 545 message = "<html>" + message + "</html>"; 546 Main.error(e); 547 return message; 530 Main.error(e); 531 return "<html>" + message + "</html>"; 548 532 } 549 533 … … 555 539 */ 556 540 public static String explainBandwidthLimitExceeded(OsmApiException e) { 541 Main.error(e); 557 542 // TODO: Write a proper error message 558 String message = explainGenericOsmApiException(e); 559 Main.error(e); 560 return message; 561 } 562 543 return explainGenericOsmApiException(e); 544 } 563 545 564 546 /** … … 574 556 + "it. Please carefully check the server''s address ''{0}'' for typos." 575 557 , apiUrl); 576 message = "<html>" + message + "</html>"; 577 Main.error(e); 578 return message; 558 Main.error(e); 559 return "<html>" + message + "</html>"; 579 560 } 580 561 … … 596 577 } 597 578 598 String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 579 Main.error(e); 580 return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 599 581 + "Host name ''{1}'' could not be resolved. <br>" 600 582 + "Please check the API URL in your preferences and your internet connection.", apiUrl, host); 601 Main.error(e);602 return message;603 583 } 604 584 … … 669 649 */ 670 650 public static String explainGoneForUnknownPrimitive(OsmApiException e) { 671 String msg =tr(651 return tr( 672 652 "<html>The server reports that an object is deleted.<br>" 673 653 + "<strong>Uploading failed</strong> if you tried to update or delete this object.<br> " … … 676 656 + "The error message is:<br>" + "{0}" 677 657 + "</html>", escapeReservedCharactersHTML(e.getMessage())); 678 return msg;679 680 658 } 681 659 … … 686 664 */ 687 665 public static String explainException(Exception e) { 688 String msg = "";666 Main.error(e); 689 667 if (e instanceof OsmTransferException) { 690 msg =explainOsmTransferException((OsmTransferException) e);668 return explainOsmTransferException((OsmTransferException) e); 691 669 } else { 692 msg = explainGeneric(e); 693 } 694 Main.error(e); 695 return msg; 670 return explainGeneric(e); 671 } 696 672 } 697 673 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7012 r7024 804 804 img = overlay(img, ImageProvider.get("cursor/modifier/" + overlay), OverlayPosition.SOUTHEAST); 805 805 } 806 Cursor c =Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(),806 return Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(), 807 807 "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2), "Cursor"); 808 return c;809 808 } 810 809
Note:
See TracChangeset
for help on using the changeset viewer.