Ticket #13160: 13160-v2.patch
File 13160-v2.patch, 2.7 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
26 26 import java.util.Set; 27 27 import java.util.TreeMap; 28 28 import java.util.TreeSet; 29 import java.util.concurrent.atomic.AtomicBoolean; 29 30 30 31 import javax.swing.AbstractAction; 31 32 import javax.swing.JComponent; … … 1097 1098 * Action handling add button press in properties dialog. 1098 1099 */ 1099 1100 class AddAction extends JosmAction { 1101 AtomicBoolean isPerforming = new AtomicBoolean(false); 1100 1102 AddAction() { 1101 1103 super(tr("Add"), /* ICON() */ "dialogs/add", tr("Add a new key/value pair to all objects"), 1102 1104 Shortcut.registerShortcut("properties:add", tr("Add Tag"), KeyEvent.VK_A, … … 1104 1106 } 1105 1107 1106 1108 @Override 1107 public synchronizedvoid actionPerformed(ActionEvent e) {1108 if ( !isEnabled())1109 public void actionPerformed(ActionEvent e) { 1110 if (isPerforming.get()) 1109 1111 return; 1110 setEnabled(false);1112 isPerforming.set(true); 1111 1113 try { 1112 1114 editHelper.addTag(); 1113 1115 btnAdd.requestFocusInWindow(); 1114 1116 } finally { 1115 setEnabled(true);1117 isPerforming.set(false); 1116 1118 } 1117 1119 } 1118 1120 } … … 1121 1123 * Action handling edit button press in properties dialog. 1122 1124 */ 1123 1125 class EditAction extends JosmAction implements ListSelectionListener { 1126 AtomicBoolean isPerforming = new AtomicBoolean(false); 1124 1127 EditAction() { 1125 1128 super(tr("Edit"), /* ICON() */ "dialogs/edit", tr("Edit the value of the selected key for all objects"), 1126 1129 Shortcut.registerShortcut("properties:edit", tr("Edit Tags"), KeyEvent.VK_S, … … 1129 1132 } 1130 1133 1131 1134 @Override 1132 public synchronizedvoid actionPerformed(ActionEvent e) {1133 if ( !isEnabled())1135 public void actionPerformed(ActionEvent e) { 1136 if (isPerforming.get()) 1134 1137 return; 1135 setEnabled(false);1138 isPerforming.set(true); 1136 1139 try { 1137 1140 if (tagTable.getSelectedRowCount() == 1) { 1138 1141 int row = tagTable.getSelectedRow(); … … 1142 1145 editMembership(row); 1143 1146 } 1144 1147 } finally { 1145 setEnabled(true);1148 isPerforming.set(false); 1146 1149 } 1147 1150 } 1148 1151