Changeset 7750 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-11-26T21:44:56+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #6909 - remove history toggle dialog in favour of a new history button in selection toggle dialog

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r7608 r7750  
    6464import org.openstreetmap.josm.gui.dialogs.DialogsPanel;
    6565import org.openstreetmap.josm.gui.dialogs.FilterDialog;
    66 import org.openstreetmap.josm.gui.dialogs.HistoryDialog;
    6766import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    6867import org.openstreetmap.josm.gui.dialogs.MapPaintDialog;
     
    239238        addToggleDialog(new CommandStackDialog());
    240239        addToggleDialog(new UserListDialog());
    241         addToggleDialog(new HistoryDialog(), true);
    242240        addToggleDialog(conflictDialog = new ConflictDialog());
    243241        addToggleDialog(validatorDialog = new ValidatorDialog());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r7657 r7750  
    6464import org.openstreetmap.josm.gui.PopupMenuHandler;
    6565import org.openstreetmap.josm.gui.SideButton;
     66import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
    6667import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    6768import org.openstreetmap.josm.gui.util.GuiHelper;
     
    8687    private SelectAction actSelect = new SelectAction();
    8788    private SearchAction actSearch = new SearchAction();
     89    private ShowHistoryAction actShowHistory = new ShowHistoryAction();
    8890    private ZoomToJOSMSelectionAction actZoomToJOSMSelection = new ZoomToJOSMSelectionAction();
    8991    private ZoomToListSelection actZoomToListSelection = new ZoomToListSelection();
     
    104106        lstPrimitives.setSelectionModel(selectionModel);
    105107        lstPrimitives.setCellRenderer(new OsmPrimitivRenderer());
    106         lstPrimitives.setTransferHandler(null); // Fix #6290. Drag & Drop is not supported anyway and Copy/Paste is better propagated to main window
     108        // Fix #6290. Drag & Drop is not supported anyway and Copy/Paste is better propagated to main window
     109        lstPrimitives.setTransferHandler(null);
     110
     111        lstPrimitives.getSelectionModel().addListSelectionListener(actSelect);
     112        lstPrimitives.getSelectionModel().addListSelectionListener(actShowHistory);
    107113
    108114        // the select action
    109115        final SideButton selectButton = new SideButton(actSelect);
    110         lstPrimitives.getSelectionModel().addListSelectionListener(actSelect);
    111116        selectButton.createArrow(new ActionListener() {
    112117            @Override
     
    126131
    127132        createLayout(lstPrimitives, true, Arrays.asList(new SideButton[] {
    128             selectButton, searchButton
     133            selectButton, searchButton, new SideButton(actShowHistory)
    129134        }));
    130135    }
     
    280285     */
    281286    static class SearchAction extends AbstractAction implements EditLayerChangeListener {
     287        /**
     288         * Constructs a new {@code SearchAction}.
     289         */
    282290        public SearchAction() {
    283291            putValue(NAME, tr("Search"));
     
    293301        }
    294302
    295         public void updateEnabledState() {
     303        protected void updateEnabledState() {
    296304            setEnabled(Main.main != null && Main.main.hasEditLayer());
    297305        }
     
    308316     */
    309317    class SelectAction extends AbstractAction implements ListSelectionListener {
     318        /**
     319         * Constructs a new {@code SelectAction}.
     320         */
    310321        public SelectAction() {
    311322            putValue(NAME, tr("Select"));
     
    324335        }
    325336
    326         public void updateEnabledState() {
     337        protected void updateEnabledState() {
     338            setEnabled(!model.getSelected().isEmpty());
     339        }
     340
     341        @Override
     342        public void valueChanged(ListSelectionEvent e) {
     343            updateEnabledState();
     344        }
     345    }
     346
     347    /**
     348     * The action for showing history information of the current history item.
     349     */
     350    class ShowHistoryAction extends AbstractAction implements ListSelectionListener {
     351        /**
     352         * Constructs a new {@code ShowHistoryAction}.
     353         */
     354        public ShowHistoryAction() {
     355            putValue(NAME, tr("History"));
     356            putValue(SHORT_DESCRIPTION, tr("Display the history of the selected objects."));
     357            putValue(SMALL_ICON, ImageProvider.get("dialogs", "history"));
     358            updateEnabledState();
     359        }
     360
     361        @Override
     362        public void actionPerformed(ActionEvent e) {
     363            Collection<OsmPrimitive> sel = model.getSelected();
     364            if (sel.isEmpty())return;
     365            HistoryBrowserDialogManager.getInstance().showHistory(sel);
     366        }
     367
     368        protected void updateEnabledState() {
    327369            setEnabled(!model.getSelected().isEmpty());
    328370        }
     
    377419     *
    378420     */
    379     class ZoomToListSelection extends AbstractAction implements ListSelectionListener{
     421    class ZoomToListSelection extends AbstractAction implements ListSelectionListener {
     422        /**
     423         * Constructs a new {@code ZoomToListSelection}.
     424         */
    380425        public ZoomToListSelection() {
    381426            putValue(NAME, tr("Zoom to selected element(s)"));
     
    397442        }
    398443
    399         public void updateEnabledState() {
     444        protected void updateEnabledState() {
    400445            setEnabled(!model.getSelected().isEmpty());
    401446        }
Note: See TracChangeset for help on using the changeset viewer.