diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
index 3976441..13c4d22 100644
|
a
|
b
|
import org.openstreetmap.josm.tools.Utils;
|
| 127 | 127 | */ |
| 128 | 128 | public class PropertiesDialog extends ToggleDialog implements SelectionChangedListener, MapView.EditLayerChangeListener, DataSetListenerAdapter.Listener { |
| 129 | 129 | /** |
| 130 | | * Watches for double clicks and from editing or new property, depending on the |
| 131 | | * location, the click was. |
| | 130 | * Watches for mouse clicks |
| 132 | 131 | * @author imi |
| 133 | 132 | */ |
| 134 | | public class DblClickWatch extends MouseAdapter { |
| | 133 | public class MouseClickWatch extends MouseAdapter { |
| 135 | 134 | @Override public void mouseClicked(MouseEvent e) { |
| 136 | 135 | if (e.getClickCount() < 2) |
| 137 | 136 | { |
| | 137 | // single click, clear selection in other table not clicked in |
| 138 | 138 | if (e.getSource() == propertyTable) { |
| 139 | 139 | membershipTable.clearSelection(); |
| 140 | 140 | } else if (e.getSource() == membershipTable) { |
| 141 | 141 | propertyTable.clearSelection(); |
| 142 | 142 | } |
| 143 | 143 | } |
| | 144 | // double click, edit or add property |
| 144 | 145 | else if (e.getSource() == propertyTable) |
| 145 | 146 | { |
| 146 | 147 | int row = propertyTable.rowAtPoint(e.getPoint()); |
| … |
… |
public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi
|
| 646 | 647 | propertyMenu.add(helpAction); |
| 647 | 648 | |
| 648 | 649 | propertyData.setColumnIdentifiers(new String[]{tr("Key"),tr("Value")}); |
| 649 | | propertyTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
| | 650 | propertyTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
| 650 | 651 | propertyTable.getTableHeader().setReorderingAllowed(false); |
| 651 | 652 | propertyTable.addMouseListener(new PopupMenuLauncher() { |
| 652 | 653 | @Override |
| … |
… |
public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi
|
| 832 | 833 | this.btnAdd, this.btnEdit, this.btnDel |
| 833 | 834 | })); |
| 834 | 835 | |
| 835 | | DblClickWatch dblClickWatch = new DblClickWatch(); |
| 836 | | propertyTable.addMouseListener(dblClickWatch); |
| 837 | | membershipTable.addMouseListener(dblClickWatch); |
| 838 | | scrollPane.addMouseListener(dblClickWatch); |
| | 836 | MouseClickWatch mouseClickWatch = new MouseClickWatch(); |
| | 837 | propertyTable.addMouseListener(mouseClickWatch); |
| | 838 | membershipTable.addMouseListener(mouseClickWatch); |
| | 839 | scrollPane.addMouseListener(mouseClickWatch); |
| 839 | 840 | |
| 840 | 841 | selectSth.setPreferredSize(scrollPane.getSize()); |
| 841 | 842 | presets.setSize(scrollPane.getSize()); |
| … |
… |
public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi
|
| 1096 | 1097 | |
| 1097 | 1098 | @Override |
| 1098 | 1099 | public void actionPerformed(ActionEvent e) { |
| 1099 | | if (propertyTable.getSelectedRowCount() >0 ) { |
| 1100 | | int row = propertyTable.getSelectedRow(); |
| 1101 | | deleteProperty(row); |
| | 1100 | if (propertyTable.getSelectedRowCount() > 0) { |
| | 1101 | int[] rows = propertyTable.getSelectedRows(); |
| | 1102 | for (int i = rows.length - 1; i >= 0; i--) { |
| | 1103 | deleteProperty(rows[i]); |
| | 1104 | } |
| 1102 | 1105 | } else if (membershipTable.getSelectedRowCount() > 0) { |
| 1103 | 1106 | int row = membershipTable.getSelectedRow(); |
| 1104 | 1107 | deleteFromRelation(row); |
| … |
… |
public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi
|
| 1108 | 1111 | @Override |
| 1109 | 1112 | protected void updateEnabledState() { |
| 1110 | 1113 | setEnabled( |
| 1111 | | (propertyTable != null && propertyTable.getSelectedRowCount() == 1) |
| 1112 | | ^ (membershipTable != null && membershipTable.getSelectedRowCount() == 1) |
| | 1114 | (propertyTable != null && propertyTable.getSelectedRowCount() >= 1) |
| | 1115 | || (membershipTable != null && membershipTable.getSelectedRowCount() == 1) |
| 1113 | 1116 | ); |
| 1114 | 1117 | } |
| 1115 | 1118 | |