- Timestamp:
- 2011-06-22T11:47:21+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r4070 r4158 139 139 // the select action 140 140 // 141 SelectAction selectAction = new SelectAction( );141 SelectAction selectAction = new SelectAction(false); 142 142 displaylist.addListSelectionListener(selectAction); 143 143 tp.add(new SideButton(selectAction, false)); … … 430 430 */ 431 431 class SelectAction extends AbstractAction implements ListSelectionListener{ 432 public SelectAction() { 433 putValue(SHORT_DESCRIPTION,tr("Set the current selection to the list of selected relations")); 432 boolean add; 433 public SelectAction(boolean add) { 434 putValue(SHORT_DESCRIPTION, add ? tr("Add the selected relations to the current selection") 435 : tr("Set the current selection to the list of selected relations")); 434 436 putValue(SMALL_ICON, ImageProvider.get("dialogs", "select")); 435 setEnabled(false); 437 putValue(NAME, add ? tr("Select relation (add)") : tr("Select relation")); 438 this.add = add; 439 updateEnabledState(); 436 440 } 437 441 … … 444 448 selection.add(model.getRelation(i)); 445 449 } 446 Main.map.mapView.getEditLayer().data.setSelected(selection); 450 if(add) 451 Main.map.mapView.getEditLayer().data.addSelected(selection); 452 else 453 Main.map.mapView.getEditLayer().data.setSelected(selection); 454 } 455 456 protected void updateEnabledState() { 457 setEnabled(displaylist.getSelectedIndices() != null && displaylist.getSelectedIndices().length > 0); 447 458 } 448 459 449 460 public void valueChanged(ListSelectionEvent e) { 450 setEnabled(displaylist.getSelectedIndices() != null && displaylist.getSelectedIndices().length > 0);461 updateEnabledState(); 451 462 } 452 463 } … … 457 468 */ 458 469 class SelectMembersAction extends AbstractAction implements ListSelectionListener{ 459 public SelectMembersAction() { 460 putValue(SHORT_DESCRIPTION,tr("Select the members of all selected relations")); 470 boolean add; 471 public SelectMembersAction(boolean add) { 472 putValue(SHORT_DESCRIPTION,add ? tr("Add the members of all selected relations to current selection") 473 : tr("Select the members of all selected relations")); 461 474 putValue(SMALL_ICON, ImageProvider.get("selectall")); 462 putValue(NAME, tr("Select members")); 475 putValue(NAME, add ? tr("Select members (add)") : tr("Select members")); 476 this.add = add; 463 477 updateEnabledState(); 464 478 } … … 471 485 members.addAll(r.getMemberPrimitives()); 472 486 } 473 Main.map.mapView.getEditLayer().data.setSelected(members); 487 if(add) 488 Main.map.mapView.getEditLayer().data.addSelected(members); 489 else 490 Main.map.mapView.getEditLayer().data.setSelected(members); 474 491 } 475 492 … … 783 800 // -- select members action 784 801 // 785 SelectMembersAction selectMembersAction = new SelectMembersAction( );802 SelectMembersAction selectMembersAction = new SelectMembersAction(false); 786 803 displaylist.addListSelectionListener(selectMembersAction); 787 804 add(selectMembersAction); 805 806 selectMembersAction = new SelectMembersAction(true); 807 displaylist.addListSelectionListener(selectMembersAction); 808 add(selectMembersAction); 809 810 // -- select action 811 // 812 SelectAction selectAction = new SelectAction(false); 813 displaylist.addListSelectionListener(selectAction); 814 add(selectAction); 815 816 selectAction = new SelectAction(true); 817 displaylist.addListSelectionListener(selectAction); 818 add(selectAction); 788 819 } 789 820
Note:
See TracChangeset
for help on using the changeset viewer.