Ticket #23555: 23555.core.patch

File 23555.core.patch, 3.1 KB (added by taylor.smock, 2 years ago)

Possible patch adding function for use by plugins

  • src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java

    Subject: [PATCH] #23555: Patch for plugins
    ---
    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 b  
    486486            final TagCollection tagsOfPrimitives,
    487487            final Collection<? extends OsmPrimitive> primitives,
    488488            final Collection<? extends OsmPrimitive> targetPrimitives) throws UserCancelException {
     489        return launchIfNecessary(tagsOfPrimitives, primitives, targetPrimitives, false);
     490    }
    489491
     492    /**
     493     * Replies the list of {@link Command commands} needed to resolve specified conflicts,
     494     * by displaying if necessary a {@link CombinePrimitiveResolverDialog} to the user.
     495     * This dialog will allow the user to choose conflict resolution actions.
     496     * <p>
     497     * Non-expert users are informed first of the meaning of these operations, allowing them to cancel.
     498     *
     499     * @param tagsOfPrimitives The tag collection of the primitives to be combined.
     500     *                         Should generally be equal to {@code TagCollection.unionOfAllPrimitives(primitives)}
     501     * @param primitives The primitives to be combined
     502     * @param targetPrimitives The primitives the collection of primitives are merged or combined to.
     503     * @param onlyConflictingTags {@code true} if we want to show the dialog <i>only if</i> there are tags that conflict
     504     * @return The list of {@link Command commands} needed to apply resolution actions.
     505     * @throws UserCancelException If the user cancelled a dialog.
     506     * @since xxx
     507     */
     508    public static List<Command> launchIfNecessary(
     509            final TagCollection tagsOfPrimitives,
     510            final Collection<? extends OsmPrimitive> primitives,
     511            final Collection<? extends OsmPrimitive> targetPrimitives,
     512            boolean onlyConflictingTags) throws UserCancelException {
    490513        CheckParameterUtil.ensureParameterNotNull(tagsOfPrimitives, "tagsOfPrimitives");
    491514        CheckParameterUtil.ensureParameterNotNull(primitives, "primitives");
    492515        CheckParameterUtil.ensureParameterNotNull(targetPrimitives, "targetPrimitives");
     
    518541
    519542        tagModel.populate(tagsToEdit, completeWayTags.getKeysWithMultipleValues(), false);
    520543        relModel.populate(parentRelations, primitives, false);
    521         if (Config.getPref().getBoolean("combine-conflict-precise", true)) {
     544        if (onlyConflictingTags || Config.getPref().getBoolean("combine-conflict-precise", true)) {
    522545            tagModel.prepareDefaultTagDecisions(getResolvableKeys(tagsOfPrimitives.getKeys(), primitives));
    523546        } else {
    524547            tagModel.prepareDefaultTagDecisions(false);