Ticket #6561: 6561.patch
File 6561.patch, 10.7 KB (added by , 14 years ago) |
---|
-
src/org/openstreetmap/josm/actions/MergeNodesAction.java
diff --git a/src/org/openstreetmap/josm/actions/MergeNodesAction.java b/src/org/openstreetmap/josm/actions/MergeNodesAction.java index 63f36d6..5118068 100644
a b public class MergeNodesAction extends JosmAction { 214 214 }; 215 215 HelpAwareOptionPane.showOptionDialog( 216 216 Main.parent, 217 tr( 218 "Cannot merge nodes: Would have to delete way ''{0}'' which is still used.", 219 w.getDisplayName(DefaultNameFormatter.getInstance()) 220 ), 217 tr("Cannot merge nodes: Would have to delete way {0} which is still used by {1}", 218 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w), 219 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w.getReferrers())), 221 220 tr("Warning"), 222 221 JOptionPane.WARNING_MESSAGE, 223 222 null, /* no icon */ -
src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java
diff --git a/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java b/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java index 5a98e40..8eaac96 100644
a b public class DownloadOsmTaskList { 159 159 ), 160 160 }; 161 161 162 String message = "<html>" 163 + trn("There is {0} object in your local dataset which " 164 + "might be deleted on the server. If you later try to delete or " 165 + "update this the server is likely to report a conflict.", 166 "There are {0} objects in your local dataset which " 167 + "might be deleted on the server. If you later try to delete or " 168 + "update them the server is likely to report a conflict.", potentiallyDeleted.size(), potentiallyDeleted.size()) 169 + "<br>" 170 + trn("Click <strong>{0}</strong> to check the state of this object on the server.", 171 "Click <strong>{0}</strong> to check the state of these objects on the server.", 172 potentiallyDeleted.size(), 173 options[0].text) + "<br>" 174 + tr("Click <strong>{0}</strong> to ignore." + "</html>", options[1].text); 162 String message = "<html>" + trn( 163 "There is {0} object in your local dataset which " 164 + "might be deleted on the server.<br>If you later try to delete or " 165 + "update this the server is likely to report a conflict.", 166 "There are {0} objects in your local dataset which " 167 + "might be deleted on the server.<br>If you later try to delete or " 168 + "update them the server is likely to report a conflict.", 169 potentiallyDeleted.size(), potentiallyDeleted.size()) 170 + "<br>" 171 + trn("Click <strong>{0}</strong> to check the state of this object on the server.", 172 "Click <strong>{0}</strong> to check the state of these objects on the server.", 173 potentiallyDeleted.size(), 174 options[0].text) + "<br>" 175 + tr("Click <strong>{0}</strong> to ignore." + "</html>", options[1].text); 175 176 176 177 int ret = HelpAwareOptionPane.showOptionDialog( 177 178 Main.parent, -
src/org/openstreetmap/josm/command/DeleteCommand.java
diff --git a/src/org/openstreetmap/josm/command/DeleteCommand.java b/src/org/openstreetmap/josm/command/DeleteCommand.java index e6751cc..b1fc08d 100644
a b public class DeleteCommand extends Command { 473 473 } 474 474 475 475 private static boolean confirmRelationDeletion(Collection<Relation> relations) { 476 String relationString = "<ul>";477 for(Relation r:relations) {478 relationString += "<li>"+DefaultNameFormatter.getInstance().format(r) + "</li>";479 }480 relationString += "</ul>";481 482 476 JPanel msg = new JPanel(new GridBagLayout()); 483 477 msg.add(new JLabel("<html>" + trn( 484 478 "You are about to delete {0} relation: {1}" … … public class DeleteCommand extends Command { 491 485 + "This step is rarely necessary and cannot be undone easily after being uploaded to the server." 492 486 + "<br/>" 493 487 + "Do you really want to delete?", 494 relations.size(), relations.size(), relationString) + "</html>")); 488 relations.size(), relations.size(), DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(relations)) 489 + "</html>")); 495 490 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 496 491 "delete_relations", 497 492 Main.parent, -
src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java
diff --git a/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java b/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java index 12ee0d3..071d8be 100644
a b package org.openstreetmap.josm.data.osm; 3 3 4 4 public class DataIntegrityProblemException extends RuntimeException { 5 5 6 private String htmlMessage; 7 6 8 public DataIntegrityProblemException(String message) { 7 9 super(message); 8 10 } 9 11 12 public DataIntegrityProblemException(String message, String htmlMessage) { 13 super(message); 14 this.htmlMessage = htmlMessage; 15 } 16 17 public String getHtmlMessage() { 18 return htmlMessage; 19 } 10 20 } -
src/org/openstreetmap/josm/data/osm/Way.java
diff --git a/src/org/openstreetmap/josm/data/osm/Way.java b/src/org/openstreetmap/josm/data/osm/Way.java index 5a5e847..4826657 100644
a b import org.openstreetmap.josm.Main; 13 13 import org.openstreetmap.josm.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 15 15 import org.openstreetmap.josm.data.osm.visitor.Visitor; 16 import org.openstreetmap.josm.gui.DefaultNameFormatter; 16 17 import org.openstreetmap.josm.tools.CopyList; 17 18 import org.openstreetmap.josm.tools.Pair; 18 19 … … public final class Way extends OsmPrimitive implements IWay { 507 508 Node[] nodes = this.nodes; 508 509 for (Node n: nodes) { 509 510 if (n.getDataSet() != dataSet) 510 throw new DataIntegrityProblemException("Nodes in way must be in the same dataset"); 511 throw new DataIntegrityProblemException("Nodes in way must be in the same dataset", 512 tr("Nodes in way must be in the same dataset")); 511 513 if (n.isDeleted()) 512 throw new DataIntegrityProblemException("Deleted node referenced: " + toString()); 514 throw new DataIntegrityProblemException("Deleted node referenced: " + toString(), 515 "<html>" + tr("Deleted node referenced by {0}", DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>"); 513 516 } 514 517 if (Main.pref.getBoolean("debug.checkNullCoor", true)) { 515 518 for (Node n: nodes) { 516 519 if (!n.isIncomplete() && (n.getCoor() == null || n.getEastNorth() == null)) 517 throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + n.get3892DebugInfo()); 520 throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + n.get3892DebugInfo(), 521 "<html>" + tr("Complete node {0} with null coordinates in way {1}", 522 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(n), 523 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>"); 518 524 } 519 525 } 520 526 } -
src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
diff --git a/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java b/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java index 142f3d4..0b06aa0 100644
a b import static org.openstreetmap.josm.tools.I18n.trn; 8 8 9 9 import java.util.ArrayList; 10 10 import java.util.Arrays; 11 import java.util.Collection; 11 12 import java.util.Collections; 12 13 import java.util.Comparator; 13 14 import java.util.HashSet; … … import org.openstreetmap.josm.data.osm.IPrimitive; 22 23 import org.openstreetmap.josm.data.osm.IRelation; 23 24 import org.openstreetmap.josm.data.osm.NameFormatter; 24 25 import org.openstreetmap.josm.data.osm.Node; 26 import org.openstreetmap.josm.data.osm.OsmPrimitive; 25 27 import org.openstreetmap.josm.data.osm.OsmUtils; 26 28 import org.openstreetmap.josm.data.osm.Relation; 27 29 import org.openstreetmap.josm.data.osm.Way; … … public class DefaultNameFormatter implements NameFormatter, HistoryNameFormatter 707 709 sb.append("</html>"); 708 710 return sb.toString(); 709 711 } 712 713 public String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives) { 714 StringBuilder sb = new StringBuilder(1024); 715 sb.append("<ul>"); 716 for (OsmPrimitive i : primitives) { 717 sb.append("<li>").append(i.getDisplayName(this)).append("</li>"); 718 } 719 sb.append("</ul>"); 720 return sb.toString(); 721 } 722 723 public String formatAsHtmlUnorderedList(OsmPrimitive... primitives) { 724 return formatAsHtmlUnorderedList(Arrays.asList(primitives)); 725 } 710 726 } -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
diff --git a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java index 2b06a02..83b3d80 100644
a b public class OsmDataLayer extends Layer implements Listener, SelectionChangedLis 328 328 } catch (DataIntegrityProblemException e) { 329 329 JOptionPane.showMessageDialog( 330 330 Main.parent, 331 e.get Message(),331 e.getHtmlMessage() != null ? e.getHtmlMessage() : e.getMessage(), 332 332 tr("Error"), 333 333 JOptionPane.ERROR_MESSAGE 334 334 );