- Timestamp:
- 2009-08-02T11:22:27+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r1868 r1878 601 601 buttonPanel.add(new SideButton(setRoleAction)); 602 602 tfRole.getDocument().addDocumentListener(setRoleAction); 603 tfRole.addActionListener(setRoleAction); 603 604 604 605 // --- copy relation action … … 666 667 ); 667 668 switch(ret) { 668 669 670 671 672 673 669 case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION: return; 670 case JOptionPane.CLOSED_OPTION: return; 671 case JOptionPane.NO_OPTION: return; 672 case JOptionPane.YES_OPTION: 673 memberTableModel.removeMembersReferringTo(toCheck); 674 break; 674 675 } 675 676 } … … 704 705 ); 705 706 switch(ret) { 706 707 708 709 710 707 case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION : return true; 708 case JOptionPane.YES_OPTION: return true; 709 case JOptionPane.NO_OPTION: return false; 710 case JOptionPane.CLOSED_OPTION: return false; 711 case JOptionPane.CANCEL_OPTION: throw new AddAbortException(); 711 712 } 712 713 // should not happen … … 1079 1080 ); 1080 1081 switch(ret) { 1081 1082 1083 1082 case JOptionPane.CANCEL_OPTION: return false; 1083 case JOptionPane.YES_OPTION: return true; 1084 case JOptionPane.NO_OPTION: return false; 1084 1085 } 1085 1086 return false; … … 1288 1289 1289 1290 protected void refreshEnabled() { 1290 setEnabled(memberTable.getSelectedRowCount() > 0 && !tfRole.getText().equals("")); 1291 } 1292 1293 public void actionPerformed(ActionEvent e) { 1291 setEnabled(memberTable.getSelectedRowCount() > 0); 1292 } 1293 1294 protected boolean isEmptyRole() { 1295 return tfRole.getText() == null || tfRole.getText().trim().equals(""); 1296 } 1297 1298 protected boolean confirmSettingEmptyRole(int onNumMembers) { 1299 String message = tr("<html>You are setting an empty role on {0} primitives.<br>" 1300 + "This is equal to deleting the roles of these primitives.<br>" 1301 + "Do you really want to apply the new role?</html>", onNumMembers); 1302 String [] options = new String[] { 1303 tr("Yes, apply it"), 1304 tr("No, don't apply") 1305 }; 1306 int ret = ConditionalOptionPaneUtil.showOptionDialog( 1307 "relation_editor.confirm_applying_empty_role", 1308 Main.parent, 1309 message, 1310 tr("Confirm empty role"), 1311 JOptionPane.YES_NO_OPTION, 1312 JOptionPane.WARNING_MESSAGE, 1313 options, 1314 options[0] 1315 ); 1316 switch(ret) { 1317 case JOptionPane.YES_OPTION: return true; 1318 case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION: return true; 1319 default: 1320 return false; 1321 } 1322 } 1323 1324 public void actionPerformed(ActionEvent e) { 1325 if (isEmptyRole()) { 1326 if (! confirmSettingEmptyRole(memberTable.getSelectedRowCount())) 1327 return; 1328 } 1294 1329 memberTableModel.updateRole(memberTable.getSelectedRows(), tfRole.getText()); 1295 1330 }
Note:
See TracChangeset
for help on using the changeset viewer.