Ticket #19275: 19275.2.patch

File 19275.2.patch, 2.4 KB (added by GerdP, 4 years ago)
  • src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

     
    3333import javax.swing.event.PopupMenuEvent;
    3434import javax.swing.event.PopupMenuListener;
    3535
     36import org.openstreetmap.josm.actions.AbstractShowHistoryAction;
    3637import org.openstreetmap.josm.actions.ExpertToggleAction;
     38import org.openstreetmap.josm.actions.IPrimitiveAction;
    3739import org.openstreetmap.josm.actions.relation.AddSelectionToRelations;
    3840import org.openstreetmap.josm.actions.relation.DeleteRelationsAction;
    3941import org.openstreetmap.josm.actions.relation.DuplicateRelationAction;
     
    7274import org.openstreetmap.josm.gui.SideButton;
    7375import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    7476import org.openstreetmap.josm.gui.dialogs.relation.RelationPopupMenus;
     77import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
    7578import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
    7679import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
    7780import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     
    408411        }
    409412    }
    410413
     414    static class ShowHistoryAction extends AbstractShowHistoryAction implements IPrimitiveAction {
     415        private Collection<? extends IPrimitive> primitives;
     416
     417        @Override
     418        public void actionPerformed(ActionEvent e) {
     419            if (primitives != null && !primitives.isEmpty()) {
     420                HistoryBrowserDialogManager.getInstance().showHistory(primitives);
     421            }
     422        }
     423
     424        @Override
     425        public void setPrimitives(Collection<? extends IPrimitive> primitives) {
     426            this.primitives = primitives;
     427        }
     428    }
     429
    411430    /**
    412431     * The list model for the list of relations displayed in the relation list dialog.
    413432     */
     
    616635        List<JMenuItem> checkDisabled = new ArrayList<>();
    617636
    618637        RelationPopupMenus.setupHandler(popupMenuHandler, SelectInRelationListAction.class);
     638        popupMenuHandler.addSeparator();
     639        popupMenuHandler.addAction(new ShowHistoryAction());
    619640
    620641        // -- export relation to gpx action
    621642        popupMenuHandler.addSeparator();