Changeset 4459 in josm
- Timestamp:
- 2011-09-24T12:19:54+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r4369 r4459 21 21 22 22 import javax.swing.AbstractAction; 23 import javax.swing.Action; 23 24 import javax.swing.DefaultListSelectionModel; 24 25 import javax.swing.JCheckBox; 25 26 import javax.swing.JList; 27 import javax.swing.JMenuItem; 26 28 import javax.swing.JPanel; 27 import javax.swing.JPopupMenu;28 29 import javax.swing.JScrollPane; 29 30 import javax.swing.ListSelectionModel; … … 51 52 import org.openstreetmap.josm.gui.help.HelpUtil; 52 53 import org.openstreetmap.josm.gui.io.CloseChangesetTask; 54 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 53 55 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 54 56 import org.openstreetmap.josm.tools.BugReportExceptionHandler; … … 83 85 private CloseOpenChangesetsAction closeChangesetAction; 84 86 private LaunchChangesetManagerAction launchChangesetManagerAction; 87 88 private ChangesetDialogPopup popupMenu; 85 89 86 90 protected void buildChangesetsLists() { … … 188 192 selectObjectsAction = new SelectObjectsAction(); 189 193 cbInSelectionOnly.addItemListener(selectObjectsAction); 190 lstInActiveDataLayer.getSelectionModel().addListSelectionListener(selectObjectsAction);191 lstInSelection.getSelectionModel().addListSelectionListener(selectObjectsAction);192 194 193 195 // -- read changesets action 194 196 readChangesetAction = new ReadChangesetsAction(); 195 197 cbInSelectionOnly.addItemListener(readChangesetAction); 196 lstInActiveDataLayer.getSelectionModel().addListSelectionListener(readChangesetAction);197 lstInSelection.getSelectionModel().addListSelectionListener(readChangesetAction);198 198 199 199 // -- close changesets action 200 200 closeChangesetAction = new CloseOpenChangesetsAction(); 201 201 cbInSelectionOnly.addItemListener(closeChangesetAction); 202 lstInActiveDataLayer.getSelectionModel().addListSelectionListener(closeChangesetAction);203 lstInSelection.getSelectionModel().addListSelectionListener(closeChangesetAction);204 202 205 203 // -- show info action 206 204 showChangesetInfoAction = new ShowChangesetInfoAction(); 207 205 cbInSelectionOnly.addItemListener(showChangesetInfoAction); 208 lstInActiveDataLayer.getSelectionModel().addListSelectionListener(showChangesetInfoAction);209 lstInSelection.getSelectionModel().addListSelectionListener(showChangesetInfoAction);210 206 211 207 // -- launch changeset manager action 212 208 launchChangesetManagerAction = new LaunchChangesetManagerAction(); 213 209 cbInSelectionOnly.addItemListener(launchChangesetManagerAction); 214 lstInActiveDataLayer.getSelectionModel().addListSelectionListener(launchChangesetManagerAction);215 lstInSelection.getSelectionModel().addListSelectionListener(launchChangesetManagerAction);210 211 popupMenu = new ChangesetDialogPopup(lstInActiveDataLayer, lstInSelection); 216 212 217 213 createLayout(pnl, false, Arrays.asList(new SideButton[] { … … 536 532 } 537 533 } 538 ChangesetDialogPopup popup = new ChangesetDialogPopup(); 539 popup.show(lst, evt.getX(), evt.getY()); 540 541 } 542 } 543 544 class ChangesetDialogPopup extends JPopupMenu { 545 public ChangesetDialogPopup() { 534 popupMenu.show(lst, evt.getX(), evt.getY()); 535 } 536 } 537 538 class ChangesetDialogPopup extends ListPopupMenu { 539 public ChangesetDialogPopup(JList ... lists) { 540 super(lists); 546 541 add(selectObjectsAction); 547 542 addSeparator(); … … 552 547 } 553 548 } 549 550 public void addPopupMenuSeparator() { 551 popupMenu.addSeparator(); 552 } 553 554 public JMenuItem addPopupMenuAction(Action a) { 555 return popupMenu.add(a); 556 } 554 557 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r4353 r4459 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 6 7 import java.awt.BorderLayout;8 7 import java.awt.Point; 9 8 import java.awt.event.ActionEvent; … … 22 21 import javax.swing.AbstractAction; 23 22 import javax.swing.AbstractListModel; 23 import javax.swing.Action; 24 24 import javax.swing.DefaultListSelectionModel; 25 25 import javax.swing.JList; 26 import javax.swing.J PopupMenu;26 import javax.swing.JMenuItem; 27 27 import javax.swing.KeyStroke; 28 28 import javax.swing.ListSelectionModel; … … 56 56 import org.openstreetmap.josm.gui.layer.Layer; 57 57 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 58 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 58 59 import org.openstreetmap.josm.tools.ImageProvider; 59 60 import org.openstreetmap.josm.tools.Shortcut; … … 142 143 displaylist.getActionMap().put("deleteRelation", deleteAction); 143 144 144 popupMenu = new RelationDialogPopupMenu( );145 popupMenu = new RelationDialogPopupMenu(displaylist); 145 146 } 146 147 … … 777 778 } 778 779 779 class RelationDialogPopupMenu extends JPopupMenu { 780 protected void build() { 780 class RelationDialogPopupMenu extends ListPopupMenu { 781 782 public RelationDialogPopupMenu(JList list) { 783 super(list); 784 781 785 // -- download members action 782 786 // 783 DownloadMembersAction downloadMembersAction = new DownloadMembersAction(); 784 displaylist.addListSelectionListener(downloadMembersAction); 785 add(downloadMembersAction); 787 add(new DownloadMembersAction()); 786 788 787 789 // -- download incomplete members action 788 790 // 789 DownloadSelectedIncompleteMembersAction downloadSelectedIncompleteMembers = new DownloadSelectedIncompleteMembersAction(); 790 displaylist.addListSelectionListener(downloadSelectedIncompleteMembers); 791 add(downloadSelectedIncompleteMembers); 791 add(new DownloadSelectedIncompleteMembersAction()); 792 792 793 793 addSeparator(); … … 795 795 // -- select members action 796 796 // 797 SelectMembersAction selectMembersAction = new SelectMembersAction(false); 798 displaylist.addListSelectionListener(selectMembersAction); 799 add(selectMembersAction); 800 801 selectMembersAction = new SelectMembersAction(true); 802 displaylist.addListSelectionListener(selectMembersAction); 803 add(selectMembersAction); 797 add(new SelectMembersAction(false)); 798 add(new SelectMembersAction(true)); 804 799 805 800 // -- select action 806 801 // 807 SelectAction selectAction = new SelectAction(false); 808 displaylist.addListSelectionListener(selectAction); 809 add(selectAction); 810 811 selectAction = new SelectAction(true); 812 displaylist.addListSelectionListener(selectAction); 813 add(selectAction); 814 } 815 816 public RelationDialogPopupMenu() { 817 build(); 818 } 802 add(new SelectAction(false)); 803 add(new SelectAction(true)); 804 } 805 } 806 807 public void addPopupMenuSeparator() { 808 popupMenu.addSeparator(); 809 } 810 811 public JMenuItem addPopupMenuAction(Action a) { 812 return popupMenu.add(a); 819 813 } 820 814 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r4408 r4459 24 24 import javax.swing.AbstractAction; 25 25 import javax.swing.AbstractListModel; 26 import javax.swing.Action; 26 27 import javax.swing.DefaultListSelectionModel; 27 28 import javax.swing.JList; … … 67 68 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; 68 69 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 70 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 69 71 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 70 72 import org.openstreetmap.josm.tools.ImageProvider; … … 86 88 private EditRelationSelection actEditRelationSelection; 87 89 private DownloadSelectedIncompleteMembersAction actDownloadSelectedIncompleteMembers; 90 91 private SelectionPopup popupMenu; 88 92 89 93 /** … … 134 138 135 139 actZoomToListSelection = new ZoomToListSelection(); 136 lstPrimitives.getSelectionModel().addListSelectionListener(actZoomToListSelection);137 138 140 actSetRelationSelection = new SetRelationSelection(); 139 lstPrimitives.getSelectionModel().addListSelectionListener(actSetRelationSelection);140 141 141 actEditRelationSelection = new EditRelationSelection(); 142 lstPrimitives.getSelectionModel().addListSelectionListener(actEditRelationSelection);143 144 142 actDownloadSelectedIncompleteMembers = new DownloadSelectedIncompleteMembersAction(); 145 lstPrimitives.getSelectionModel().addListSelectionListener(actDownloadSelectedIncompleteMembers);146 143 147 144 lstPrimitives.addMouseListener(new SelectionPopupMenuLauncher()); 148 145 lstPrimitives.addMouseListener(new DblClickHandler()); 146 147 popupMenu = new SelectionPopup(lstPrimitives); 149 148 } 150 149 … … 190 189 */ 191 190 class SelectionPopupMenuLauncher extends PopupMenuLauncher { 192 private SelectionPopup popup = new SelectionPopup();193 191 194 192 @Override … … 199 197 model.setSelected(Collections.singleton((OsmPrimitive)model.getElementAt(idx))); 200 198 } 201 popup .show(lstPrimitives, evt.getX(), evt.getY());199 popupMenu.show(lstPrimitives, evt.getX(), evt.getY()); 202 200 } 203 201 } … … 206 204 * The popup menu for the selection list 207 205 */ 208 class SelectionPopup extends JPopupMenu { 209 public SelectionPopup() { 206 class SelectionPopup extends ListPopupMenu { 207 public SelectionPopup(JList list) { 208 super(list); 210 209 add(actZoomToJOSMSelection); 211 210 add(actZoomToListSelection); … … 216 215 add(actDownloadSelectedIncompleteMembers); 217 216 } 217 } 218 219 public void addPopupMenuSeparator() { 220 popupMenu.addSeparator(); 221 } 222 223 public JMenuItem addPopupMenuAction(Action a) { 224 return popupMenu.add(a); 218 225 } 219 226
Note:
See TracChangeset
for help on using the changeset viewer.