Changeset 14685 in josm for trunk/src/org
- Timestamp:
- 2019-01-12T21:19:22+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r14475 r14685 34 34 35 35 import org.openstreetmap.josm.actions.ExpertToggleAction; 36 import org.openstreetmap.josm.actions.IPrimitiveAction;37 36 import org.openstreetmap.josm.actions.relation.AddSelectionToRelations; 38 37 import org.openstreetmap.josm.actions.relation.DeleteRelationsAction; 39 import org.openstreetmap.josm.actions.relation.DownloadMembersAction;40 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction;41 38 import org.openstreetmap.josm.actions.relation.DuplicateRelationAction; 42 39 import org.openstreetmap.josm.actions.relation.EditRelationAction; … … 44 41 import org.openstreetmap.josm.actions.relation.ExportRelationToGpxAction.Mode; 45 42 import org.openstreetmap.josm.actions.relation.RecentRelationsAction; 46 import org.openstreetmap.josm.actions.relation.Select MembersAction;43 import org.openstreetmap.josm.actions.relation.SelectInRelationListAction; 47 44 import org.openstreetmap.josm.actions.relation.SelectRelationAction; 48 45 import org.openstreetmap.josm.data.osm.DataSet; … … 73 70 import org.openstreetmap.josm.gui.SideButton; 74 71 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; 72 import org.openstreetmap.josm.gui.dialogs.relation.RelationPopupMenus; 75 73 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 76 74 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; … … 99 97 */ 100 98 public class RelationListDialog extends ToggleDialog 101 implements DataSetListener, NavigatableComponent.ZoomChangeListener , ExpertToggleAction.ExpertModeChangeListener{99 implements DataSetListener, NavigatableComponent.ZoomChangeListener { 102 100 /** The display list. */ 103 101 private final JList<IRelation<?>> displaylist; … … 120 118 /** the duplicate action */ 121 119 private final DuplicateRelationAction duplicateAction = new DuplicateRelationAction(); 122 private final DownloadMembersAction downloadMembersAction = new DownloadMembersAction(); 123 private final DownloadSelectedIncompleteMembersAction downloadSelectedIncompleteMembersAction = 124 new DownloadSelectedIncompleteMembersAction(); 125 private final SelectMembersAction selectMembersAction = new SelectMembersAction(false); 126 private final SelectMembersAction addMembersToSelectionAction = new SelectMembersAction(true); 120 /** the select relation action */ 127 121 private final SelectRelationAction selectRelationAction = new SelectRelationAction(false); 128 private final SelectRelationAction addRelationToSelectionAction = new SelectRelationAction(true);129 122 /** add all selected primitives to the given relations */ 130 123 private final AddSelectionToRelations addSelectionToRelations = new AddSelectionToRelations(); 131 private transient JMenuItem addSelectionToRelationMenuItem;132 124 133 125 /** export relation to GPX track action */ … … 245 237 SelectionEventManager.getInstance().addSelectionListener(addSelectionToRelations); 246 238 dataChanged(null); 247 ExpertToggleAction.addExpertModeChangeListener(this);248 expertChanged(ExpertToggleAction.isExpert());249 239 } 250 240 … … 256 246 DatasetEventManager.getInstance().removeDatasetListener(this); 257 247 SelectionEventManager.getInstance().removeSelectionListener(addSelectionToRelations); 258 ExpertToggleAction.removeExpertModeChangeListener(this);259 248 } 260 249 … … 632 621 List<JMenuItem> checkDisabled = new ArrayList<>(); 633 622 634 // -- select action 635 popupMenuHandler.addAction(selectRelationAction); 636 popupMenuHandler.addAction(addRelationToSelectionAction); 637 638 // -- select members action 639 popupMenuHandler.addAction(selectMembersAction); 640 popupMenuHandler.addAction(addMembersToSelectionAction); 641 642 // -- download members action 643 popupMenuHandler.addSeparator(); 644 popupMenuHandler.addAction(downloadMembersAction); 645 popupMenuHandler.addAction(downloadSelectedIncompleteMembersAction); 623 RelationPopupMenus.setupHandler(popupMenuHandler, SelectInRelationListAction.class); 646 624 647 625 // -- export relation to gpx action … … 658 636 popupMenuHandler.addAction(deleteRelationsAction).setVisible(false); 659 637 660 addSelectionToRelationMenuItem = popupMenuHandler.addAction(addSelectionToRelations);638 ExpertToggleAction.addVisibilitySwitcher(popupMenuHandler.addAction(addSelectionToRelations)); 661 639 662 640 popupMenuHandler.addListener(new PopupMenuListener() { … … 664 642 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 665 643 for (JMenuItem mi: checkDisabled) { 666 mi.setVisible(((IPrimitiveAction) mi.getAction()).isEnabled()); 667 668 Component sep = popupMenu.getComponent( 669 Math.max(0, popupMenu.getComponentIndex(mi)-1)); 644 mi.setVisible(mi.getAction().isEnabled()); 645 Component sep = popupMenu.getComponent(Math.max(0, popupMenu.getComponentIndex(mi) - 1)); 670 646 if (!(sep instanceof JMenuItem)) { 671 647 sep.setVisible(mi.isVisible()); … … 770 746 } 771 747 } 772 773 @Override774 public void expertChanged(boolean isExpert) {775 addSelectionToRelationMenuItem.setVisible(isExpert);776 }777 748 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r14609 r14685 40 40 import org.openstreetmap.josm.actions.AutoScaleAction; 41 41 import org.openstreetmap.josm.actions.AutoScaleAction.AutoScaleMode; 42 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction;43 42 import org.openstreetmap.josm.actions.relation.EditRelationAction; 44 import org.openstreetmap.josm.actions.relation.SelectInRelationListAction;45 43 import org.openstreetmap.josm.data.osm.DataSelectionListener; 46 44 import org.openstreetmap.josm.data.osm.DataSet; … … 72 70 import org.openstreetmap.josm.gui.datatransfer.PrimitiveTransferable; 73 71 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; 72 import org.openstreetmap.josm.gui.dialogs.relation.RelationPopupMenus; 74 73 import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager; 75 74 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; … … 100 99 private final ZoomToJOSMSelectionAction actZoomToJOSMSelection = new ZoomToJOSMSelectionAction(); 101 100 private final ZoomToListSelection actZoomToListSelection = new ZoomToListSelection(); 102 private final SelectInRelationListAction actSetRelationSelection = new SelectInRelationListAction();103 private final EditRelationAction actEditRelationSelection = new EditRelationAction();104 private final DownloadSelectedIncompleteMembersAction actDownloadSelIncompleteMembers = new DownloadSelectedIncompleteMembersAction();105 101 106 102 /** the popup menu and its handler */ … … 216 212 } else if (osm instanceof Relation) { 217 213 // else open relation editor if applicable 218 actEditRelationSelection.actionPerformed(null);214 EditRelationAction.launchEditor((Relation) osm); 219 215 } 220 216 } else if (highlightEnabled && MainApplication.isDisplayingMapView() && helper.highlightOnly(model.getElementAt(idx))) { … … 235 231 handler.addAction(actZoomToListSelection); 236 232 handler.addSeparator(); 237 handler.addAction(actSetRelationSelection); 238 handler.addAction(actEditRelationSelection); 239 handler.addSeparator(); 240 handler.addAction(actDownloadSelIncompleteMembers); 241 return handler; 233 return RelationPopupMenus.setupHandler(handler); 242 234 } 243 235 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r14678 r14685 50 50 51 51 import org.openstreetmap.josm.actions.JosmAction; 52 import org.openstreetmap.josm.actions.relation.DownloadMembersAction; 53 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction; 54 import org.openstreetmap.josm.actions.relation.SelectInRelationListAction; 55 import org.openstreetmap.josm.actions.relation.SelectMembersAction; 56 import org.openstreetmap.josm.actions.relation.SelectRelationAction; 52 import org.openstreetmap.josm.actions.relation.DeleteRelationsAction; 53 import org.openstreetmap.josm.actions.relation.EditRelationAction; 57 54 import org.openstreetmap.josm.command.ChangeCommand; 58 55 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 90 87 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 91 88 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; 89 import org.openstreetmap.josm.gui.dialogs.relation.RelationPopupMenus; 92 90 import org.openstreetmap.josm.gui.help.HelpUtil; 93 91 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; … … 198 196 private final JosmAction[] josmActions = new JosmAction[]{addAction, editAction, deleteAction}; 199 197 200 // relation actions201 private final SelectInRelationListAction setRelationSelectionAction = new SelectInRelationListAction();202 private final SelectRelationAction selectRelationAction = new SelectRelationAction(false);203 private final SelectRelationAction addRelationToSelectionAction = new SelectRelationAction(true);204 205 private final DownloadMembersAction downloadMembersAction = new DownloadMembersAction();206 private final DownloadSelectedIncompleteMembersAction downloadSelectedIncompleteMembersAction =207 new DownloadSelectedIncompleteMembersAction();208 209 private final SelectMembersAction selectMembersAction = new SelectMembersAction(false);210 private final SelectMembersAction addMembersToSelectionAction = new SelectMembersAction(true);211 212 198 private final transient HighlightHelper highlightHelper = new HighlightHelper(); 213 199 … … 371 357 membershipMenu.addSeparator(); 372 358 } 373 membershipMenuHandler.addAction(setRelationSelectionAction); 374 membershipMenuHandler.addAction(selectRelationAction); 375 membershipMenuHandler.addAction(addRelationToSelectionAction); 376 membershipMenuHandler.addAction(selectMembersAction); 377 membershipMenuHandler.addAction(addMembersToSelectionAction); 378 membershipMenu.addSeparator(); 379 membershipMenuHandler.addAction(downloadMembersAction); 380 membershipMenuHandler.addAction(downloadSelectedIncompleteMembersAction); 359 RelationPopupMenus.setupHandler(membershipMenuHandler, EditRelationAction.class, DeleteRelationsAction.class); 381 360 membershipMenu.addSeparator(); 382 361 membershipMenu.add(helpAction);
Note:
See TracChangeset
for help on using the changeset viewer.