Ticket #23555: 23305-new-button.patch

File 23305-new-button.patch, 1.6 KB (added by GerdP, 2 months ago)

add new button to dialog to accept all tags with one non-null value

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

     
    240240        CancelAction cancelAction = new CancelAction();
    241241        pnl.add(new JButton(cancelAction));
    242242
     243        if (Config.getPref().getBoolean("combine-conflict-precise", true)) {
     244            // -- accept single button
     245            pnl.add(new JButton(new AcceptSimpleAction()));
     246        }
     247
    243248        // -- help button
    244249        helpAction = new ContextSensitiveHelpAction();
    245250        pnl.add(new JButton(helpAction));
     
    444449        }
    445450    }
    446451
     452    protected class AcceptSimpleAction extends AbstractAction {
     453        /**
     454         * Constructs a new {@code AcceptSingleAction}.
     455         */
     456        public AcceptSimpleAction() {
     457            putValue(Action.SHORT_DESCRIPTION, tr("Accept all tag keys with only one value"));
     458            putValue(Action.NAME, tr("Accept simple"));
     459            new ImageProvider("apply").getResource().attachImageIcon(this);
     460        }
     461
     462        @Override
     463        public void actionPerformed(ActionEvent arg0) {
     464            prepareDefaultDecisions(true);
     465        }
     466    }
     467
    447468    private void adjustDividerLocation() {
    448469        int numTagDecisions = modelTagConflictResolver.getNumDecisions();
    449470        int numRelationDecisions = modelRelConflictResolver.getNumDecisions();