Ticket #13160: 13160-v2.patch

File 13160-v2.patch, 2.7 KB (added by GerdP, 5 years ago)

forgot to remove one synchronized

  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

     
    2626import java.util.Set;
    2727import java.util.TreeMap;
    2828import java.util.TreeSet;
     29import java.util.concurrent.atomic.AtomicBoolean;
    2930
    3031import javax.swing.AbstractAction;
    3132import javax.swing.JComponent;
     
    10971098     * Action handling add button press in properties dialog.
    10981099     */
    10991100    class AddAction extends JosmAction {
     1101        AtomicBoolean isPerforming = new AtomicBoolean(false);
    11001102        AddAction() {
    11011103            super(tr("Add"), /* ICON() */ "dialogs/add", tr("Add a new key/value pair to all objects"),
    11021104                    Shortcut.registerShortcut("properties:add", tr("Add Tag"), KeyEvent.VK_A,
     
    11041106        }
    11051107
    11061108        @Override
    1107         public synchronized void actionPerformed(ActionEvent e) {
    1108             if (!isEnabled())
     1109        public void actionPerformed(ActionEvent e) {
     1110            if (isPerforming.get())
    11091111                return;
    1110             setEnabled(false);
     1112            isPerforming.set(true);
    11111113            try {
    11121114                editHelper.addTag();
    11131115                btnAdd.requestFocusInWindow();
    11141116            } finally {
    1115                 setEnabled(true);
     1117                isPerforming.set(false);
    11161118            }
    11171119        }
    11181120    }
     
    11211123     * Action handling edit button press in properties dialog.
    11221124     */
    11231125    class EditAction extends JosmAction implements ListSelectionListener {
     1126        AtomicBoolean isPerforming = new AtomicBoolean(false);
    11241127        EditAction() {
    11251128            super(tr("Edit"), /* ICON() */ "dialogs/edit", tr("Edit the value of the selected key for all objects"),
    11261129                    Shortcut.registerShortcut("properties:edit", tr("Edit Tags"), KeyEvent.VK_S,
     
    11291132        }
    11301133
    11311134        @Override
    1132         public synchronized void actionPerformed(ActionEvent e) {
    1133             if (!isEnabled())
     1135        public void actionPerformed(ActionEvent e) {
     1136            if (isPerforming.get())
    11341137                return;
    1135             setEnabled(false);
     1138            isPerforming.set(true);
    11361139            try {
    11371140                if (tagTable.getSelectedRowCount() == 1) {
    11381141                    int row = tagTable.getSelectedRow();
     
    11421145                    editMembership(row);
    11431146                }
    11441147            } finally {
    1145                 setEnabled(true);
     1148                isPerforming.set(false);
    11461149            }
    11471150        }
    11481151