Index: trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java	(revision 5059)
@@ -215,8 +215,7 @@
                     HelpAwareOptionPane.showOptionDialog(
                             Main.parent,
-                            tr(
-                                    "Cannot merge nodes: Would have to delete way ''{0}'' which is still used.",
-                                    w.getDisplayName(DefaultNameFormatter.getInstance())
-                            ),
+                            tr("Cannot merge nodes: Would have to delete way {0} which is still used by {1}",
+                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w),
+                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w.getReferrers())),
                             tr("Warning"),
                             JOptionPane.WARNING_MESSAGE,
Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java	(revision 5059)
@@ -160,17 +160,18 @@
         };
 
-        String message = "<html>"
-                + trn("There is {0} object in your local dataset which "
-                        + "might be deleted on the server. If you later try to delete or "
-                        + "update this the server is likely to report a conflict.",
-                        "There are {0} objects in your local dataset which "
-                                + "might be deleted on the server. If you later try to delete or "
-                                + "update them the server is likely to report a conflict.", potentiallyDeleted.size(), potentiallyDeleted.size())
-                                + "<br>"
-                                + trn("Click <strong>{0}</strong> to check the state of this object on the server.",
-                                        "Click <strong>{0}</strong> to check the state of these objects on the server.",
-                                        potentiallyDeleted.size(),
-                                        options[0].text) + "<br>"
-                                        + tr("Click <strong>{0}</strong> to ignore." + "</html>", options[1].text);
+        String message = "<html>" + trn(
+                "There is {0} object in your local dataset which "
+                + "might be deleted on the server.<br>If you later try to delete or "
+                + "update this the server is likely to report a conflict.",
+                "There are {0} objects in your local dataset which "
+                + "might be deleted on the server.<br>If you later try to delete or "
+                + "update them the server is likely to report a conflict.",
+                potentiallyDeleted.size(), potentiallyDeleted.size())
+                + "<br>"
+                + trn("Click <strong>{0}</strong> to check the state of this object on the server.",
+                "Click <strong>{0}</strong> to check the state of these objects on the server.",
+                potentiallyDeleted.size(),
+                options[0].text) + "<br>"
+                + tr("Click <strong>{0}</strong> to ignore." + "</html>", options[1].text);
 
         int ret = HelpAwareOptionPane.showOptionDialog(
Index: trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 5059)
@@ -474,10 +474,4 @@
 
     private static boolean confirmRelationDeletion(Collection<Relation> relations) {
-        String relationString = "<ul>";
-        for(Relation r:relations) {
-            relationString += "<li>"+DefaultNameFormatter.getInstance().format(r) + "</li>";
-        }
-        relationString += "</ul>";
-        
         JPanel msg = new JPanel(new GridBagLayout());
         msg.add(new JLabel("<html>" + trn(
@@ -492,5 +486,6 @@
                 + "<br/>"
                 + "Do you really want to delete?",
-                relations.size(), relations.size(), relationString) + "</html>"));
+                relations.size(), relations.size(), DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(relations))
+                + "</html>"));
         boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
                 "delete_relations",
Index: trunk/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java	(revision 5059)
@@ -4,7 +4,17 @@
 public class DataIntegrityProblemException extends RuntimeException {
 
+    private String htmlMessage;
+
     public DataIntegrityProblemException(String message) {
         super(message);
     }
 
+    public DataIntegrityProblemException(String message, String htmlMessage) {
+        super(message);
+        this.htmlMessage = htmlMessage;
+    }
+
+    public String getHtmlMessage() {
+        return htmlMessage;
+    }
 }
Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 5059)
@@ -14,4 +14,5 @@
 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
 import org.openstreetmap.josm.data.osm.visitor.Visitor;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
 import org.openstreetmap.josm.tools.CopyList;
 import org.openstreetmap.josm.tools.Pair;
@@ -508,12 +509,17 @@
             for (Node n: nodes) {
                 if (n.getDataSet() != dataSet)
-                    throw new DataIntegrityProblemException("Nodes in way must be in the same dataset");
+                    throw new DataIntegrityProblemException("Nodes in way must be in the same dataset",
+                            tr("Nodes in way must be in the same dataset"));
                 if (n.isDeleted())
-                    throw new DataIntegrityProblemException("Deleted node referenced: " + toString());
+                    throw new DataIntegrityProblemException("Deleted node referenced: " + toString(),
+                            "<html>" + tr("Deleted node referenced by {0}", DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>");
             }
             if (Main.pref.getBoolean("debug.checkNullCoor", true)) {
                 for (Node n: nodes) {
                     if (!n.isIncomplete() && (n.getCoor() == null || n.getEastNorth() == null))
-                        throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + n.get3892DebugInfo());
+                        throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + n.get3892DebugInfo(),
+                                "<html>" + tr("Complete node {0} with null coordinates in way {1}",
+                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(n),
+                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>");
                 }
             }
Index: trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 5059)
@@ -9,4 +9,5 @@
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
@@ -23,4 +24,5 @@
 import org.openstreetmap.josm.data.osm.NameFormatter;
 import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -708,3 +710,17 @@
         return sb.toString();
     }
+
+    public String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives) {
+        StringBuilder sb = new StringBuilder(1024);
+        sb.append("<ul>");
+        for (OsmPrimitive i : primitives) {
+            sb.append("<li>").append(i.getDisplayName(this)).append("</li>");
+        }
+        sb.append("</ul>");
+        return sb.toString();
+    }
+
+    public String formatAsHtmlUnorderedList(OsmPrimitive... primitives) {
+        return formatAsHtmlUnorderedList(Arrays.asList(primitives));
+    }
 }
Index: trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 5058)
+++ trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 5059)
@@ -329,5 +329,5 @@
             JOptionPane.showMessageDialog(
                     Main.parent,
-                    e.getMessage(),
+                    e.getHtmlMessage() != null ? e.getHtmlMessage() : e.getMessage(),
                     tr("Error"),
                     JOptionPane.ERROR_MESSAGE
