Subject: [PATCH] #23555: Patch for plugins
---
Index: src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java b/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
--- a/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java	(revision 19018)
+++ b/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java	(date 1711031958837)
@@ -486,7 +486,30 @@
             final TagCollection tagsOfPrimitives,
             final Collection<? extends OsmPrimitive> primitives,
             final Collection<? extends OsmPrimitive> targetPrimitives) throws UserCancelException {
+        return launchIfNecessary(tagsOfPrimitives, primitives, targetPrimitives, false);
+    }
 
+    /**
+     * Replies the list of {@link Command commands} needed to resolve specified conflicts,
+     * by displaying if necessary a {@link CombinePrimitiveResolverDialog} to the user.
+     * This dialog will allow the user to choose conflict resolution actions.
+     * <p>
+     * Non-expert users are informed first of the meaning of these operations, allowing them to cancel.
+     *
+     * @param tagsOfPrimitives The tag collection of the primitives to be combined.
+     *                         Should generally be equal to {@code TagCollection.unionOfAllPrimitives(primitives)}
+     * @param primitives The primitives to be combined
+     * @param targetPrimitives The primitives the collection of primitives are merged or combined to.
+     * @param onlyConflictingTags {@code true} if we want to show the dialog <i>only if</i> there are tags that conflict
+     * @return The list of {@link Command commands} needed to apply resolution actions.
+     * @throws UserCancelException If the user cancelled a dialog.
+     * @since xxx
+     */
+    public static List<Command> launchIfNecessary(
+            final TagCollection tagsOfPrimitives,
+            final Collection<? extends OsmPrimitive> primitives,
+            final Collection<? extends OsmPrimitive> targetPrimitives,
+            boolean onlyConflictingTags) throws UserCancelException {
         CheckParameterUtil.ensureParameterNotNull(tagsOfPrimitives, "tagsOfPrimitives");
         CheckParameterUtil.ensureParameterNotNull(primitives, "primitives");
         CheckParameterUtil.ensureParameterNotNull(targetPrimitives, "targetPrimitives");
@@ -518,7 +541,7 @@
 
         tagModel.populate(tagsToEdit, completeWayTags.getKeysWithMultipleValues(), false);
         relModel.populate(parentRelations, primitives, false);
-        if (Config.getPref().getBoolean("combine-conflict-precise", true)) {
+        if (onlyConflictingTags || Config.getPref().getBoolean("combine-conflict-precise", true)) {
             tagModel.prepareDefaultTagDecisions(getResolvableKeys(tagsOfPrimitives.getKeys(), primitives));
         } else {
             tagModel.prepareDefaultTagDecisions(false);
