Ignore:
Timestamp:
2019-04-09T01:32:56+02:00 (5 years ago)
Author:
Don-vip
Message:

ensures consistency of upload comment:

  • fix #11168 - ctrl-z/undo could reset unwanted old changeset comment
  • fix #13474 - selecting "new changeset" after having entered a changeset comment did reset it to the previous value
  • fix #17452 - ctrl-enter while typing a changeset comment did upload with the previous value
  • fix behaviour of upload.comment.max-age: values were reset after 5 months instead of intended 4 hours because seconds were compared to milliseconds
  • avoid creation of unneeded undo/redo internal classes for non-editable text fields
  • ensures consistency of upload dialog if upload.comment properties are modified manually from advanced preferences
  • add a source attribute to preference events to know which class modified the preference entry
  • refactor reflection utils
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java

    r14302 r14977  
    3434 */
    3535public class JosmComboBox<E> extends JComboBox<E> {
     36
     37    private final ContextMenuHandler handler = new ContextMenuHandler();
    3638
    3739    /**
     
    165167
    166168    protected final void init(E prototype) {
     169        init(prototype, true);
     170    }
     171
     172    protected final void init(E prototype, boolean registerPropertyChangeListener) {
    167173        if (prototype != null) {
    168174            setPrototypeDisplayValue(prototype);
     
    186192        }
    187193        // Handle text contextual menus for editable comboboxes
    188         ContextMenuHandler handler = new ContextMenuHandler();
    189         addPropertyChangeListener("editable", handler);
    190         addPropertyChangeListener("editor", handler);
     194        if (registerPropertyChangeListener) {
     195            addPropertyChangeListener("editable", handler);
     196            addPropertyChangeListener("editor", handler);
     197        }
    191198    }
    192199
     
    232239        }
    233240
     241        private void discardAllUndoableEdits() {
     242            if (launcher != null) {
     243                launcher.discardAllUndoableEdits();
     244            }
     245        }
     246
    234247        @Override
    235248        public void mousePressed(MouseEvent e) {
     
    250263
    251264    /**
    252      * Reinitializes this {@link JosmComboBox} to the specified values. This may needed if a custom renderer is used.
     265     * Reinitializes this {@link JosmComboBox} to the specified values. This may be needed if a custom renderer is used.
    253266     * @param values The values displayed in the combo box.
    254267     * @since 5558
    255268     */
    256269    public final void reinitialize(Collection<E> values) {
    257         init(findPrototypeDisplayValue(values));
     270        init(findPrototypeDisplayValue(values), false);
     271        discardAllUndoableEdits();
     272    }
     273
     274    /**
     275     * Empties the internal undo manager, if any.
     276     * @since 14977
     277     */
     278    public final void discardAllUndoableEdits() {
     279        handler.discardAllUndoableEdits();
    258280    }
    259281}
Note: See TracChangeset for help on using the changeset viewer.