Changeset 2945 in josm for trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
- Timestamp:
- 06.02.2010 09:37:48 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r2846 r2945 57 57 private CopyAfterCurrentLeftAction copyAfterCurrentLeftAction; 58 58 private CopyEndLeftAction copyEndLeftAction; 59 private CopyAllLeft copyAllLeft; 59 60 60 61 private CopyStartRightAction copyStartRightAction; … … 62 63 private CopyAfterCurrentRightAction copyAfterCurrentRightAction; 63 64 private CopyEndRightAction copyEndRightAction; 65 private CopyAllRight copyAllRight; 64 66 65 67 private MoveUpMergedAction moveUpMergedAction; … … 118 120 mergedEntriesTable.getSelectionModel().addListSelectionListener(moveDownMergedAction); 119 121 mergedEntriesTable.getSelectionModel().addListSelectionListener(removeMergedAction); 122 123 model.addObserver(copyAllLeft); 124 model.addObserver(copyAllRight); 125 model.addPropertyChangeListener(copyAllLeft); 126 model.addPropertyChangeListener(copyAllRight); 120 127 } 121 128 … … 153 160 pnl.add(btn, gc); 154 161 162 gc.gridx = 0; 163 gc.gridy = 4; 164 copyAllLeft = new CopyAllLeft(); 165 btn = new JButton(copyAllLeft); 166 btn.setName("button.copyallleft"); 167 pnl.add(btn, gc); 168 155 169 return pnl; 156 170 } … … 180 194 copyEndRightAction = new CopyEndRightAction(); 181 195 pnl.add(new JButton(copyEndRightAction), gc); 196 197 gc.gridx = 0; 198 gc.gridy = 4; 199 copyAllRight = new CopyAllRight(); 200 pnl.add(new JButton(copyAllRight), gc); 182 201 183 202 return pnl; … … 614 633 && ! mergedEntriesTable.getSelectionModel().isSelectionEmpty() 615 634 ); 635 } 636 } 637 638 class CopyAllLeft extends AbstractAction implements Observer, PropertyChangeListener { 639 640 public CopyAllLeft() { 641 ImageIcon icon = ImageProvider.get("dialogs/conflict", "useallleft.png"); 642 putValue(Action.SMALL_ICON, icon); 643 putValue(Action.SHORT_DESCRIPTION, tr("Use all mine elements")); 644 } 645 646 public void actionPerformed(ActionEvent arg0) { 647 model.copyAll(ListRole.MY_ENTRIES); 648 model.setFrozen(true); 649 } 650 651 private void updateEnabledState() { 652 setEnabled(model.getMergedEntries().isEmpty() && !model.isFrozen()); 653 } 654 655 public void update(Observable o, Object arg) { 656 updateEnabledState(); 657 } 658 659 public void propertyChange(PropertyChangeEvent evt) { 660 updateEnabledState(); 661 } 662 } 663 664 class CopyAllRight extends AbstractAction implements Observer, PropertyChangeListener { 665 666 public CopyAllRight() { 667 ImageIcon icon = ImageProvider.get("dialogs/conflict", "useallright.png"); 668 putValue(Action.SMALL_ICON, icon); 669 putValue(Action.SHORT_DESCRIPTION, tr("Use all their elements")); 670 } 671 672 public void actionPerformed(ActionEvent arg0) { 673 model.copyAll(ListRole.THEIR_ENTRIES); 674 model.setFrozen(true); 675 } 676 677 private void updateEnabledState() { 678 setEnabled(model.getMergedEntries().isEmpty() && !model.isFrozen()); 679 } 680 681 public void update(Observable o, Object arg) { 682 updateEnabledState(); 683 } 684 685 public void propertyChange(PropertyChangeEvent evt) { 686 updateEnabledState(); 616 687 } 617 688 }
Note: See TracChangeset
for help on using the changeset viewer.
