Ignore:
Timestamp:
2009-10-04T12:07:16+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3650: Double-click on items in history dialog should open history
fixed #3649: History dialog does not show moved nodes
fixed #3383: changeset tags in history dialog (partial fix, there's now a link to the server page for browsing changesets)

File:
1 edited

Legend:

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

    r2239 r2243  
    110110            }
    111111        });
     112        historyTable.addMouseListener(new ShowHistoryMouseAdapter());
    112113
    113114        JScrollPane pane = new JScrollPane(historyTable);
     
    138139        model.refresh();
    139140    }
    140 
    141     /**
    142      * shows the {@see HistoryBrowserDialog} for a given {@see History}
    143      *
    144      * @param h the history. Must not be null.
    145      * @exception IllegalArgumentException thrown, if h is null
    146      */
    147     protected void showHistory(History h) throws IllegalArgumentException {
    148         if (h == null)
    149             throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "h"));
    150         if (HistoryBrowserDialogManager.getInstance().existsDialog(h.getId())) {
    151             HistoryBrowserDialogManager.getInstance().show(h.getId());
    152         } else {
    153             HistoryBrowserDialog dialog = new HistoryBrowserDialog(h);
    154             HistoryBrowserDialogManager.getInstance().show(h.getId(), dialog);
    155         }
    156     }
    157 
    158141
    159142    /**
     
    233216            }
    234217            return ret;
     218        }
     219
     220        public OsmPrimitive getPrimitive(int row) {
     221            return data.get(row);
    235222        }
    236223    }
     
    286273    }
    287274
     275    class ShowHistoryMouseAdapter extends MouseAdapter {
     276        @Override
     277        public void mouseClicked(MouseEvent e) {
     278            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
     279                int row = historyTable.rowAtPoint(e.getPoint());
     280                new ShowHistoryAction().showHistory(Collections.singletonList(model.getPrimitive(row)));
     281            }
     282        }
     283    }
     284
    288285    /**
    289286     * The action for showing history information of the current history item.
     
    307304        }
    308305
    309         public void actionPerformed(ActionEvent e) {
    310             int [] rows = historyTable.getSelectedRows();
    311             if (rows == null || rows.length == 0) return;
    312 
    313             final List<OsmPrimitive> selectedItems = model.getPrimitives(rows);
    314             List<OsmPrimitive> toLoad = filterPrimitivesWithUnloadedHistory(selectedItems);
     306        /**
     307         * shows the {@see HistoryBrowserDialog} for a given {@see History}
     308         *
     309         * @param h the history. Must not be null.
     310         * @exception IllegalArgumentException thrown, if h is null
     311         */
     312        protected void showHistory(History h) throws IllegalArgumentException {
     313            if (h == null)
     314                throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "h"));
     315            if (HistoryBrowserDialogManager.getInstance().existsDialog(h.getId())) {
     316                HistoryBrowserDialogManager.getInstance().show(h.getId());
     317            } else {
     318                HistoryBrowserDialog dialog = new HistoryBrowserDialog(h);
     319                HistoryBrowserDialogManager.getInstance().show(h.getId(), dialog);
     320            }
     321        }
     322
     323        public void showHistory(final List<OsmPrimitive> primitives) {
     324            List<OsmPrimitive> toLoad = filterPrimitivesWithUnloadedHistory(primitives);
    315325            if (!toLoad.isEmpty()) {
    316326                HistoryLoadTask task = new HistoryLoadTask();
    317                 task.add(selectedItems);
     327                task.add(primitives);
    318328                Main.worker.submit(task);
    319329            }
     
    321331            Runnable r = new Runnable() {
    322332                public void run() {
    323                     for (OsmPrimitive p : selectedItems) {
     333                    for (OsmPrimitive p : primitives) {
    324334                        History h = HistoryDataSet.getInstance().getHistory(p.getId());
    325335                        if (h == null) {
     
    333343        }
    334344
     345        public void actionPerformed(ActionEvent e) {
     346            int [] rows = historyTable.getSelectedRows();
     347            if (rows == null || rows.length == 0) return;
     348            showHistory(model.getPrimitives(rows));
     349        }
     350
    335351        protected void updateEnabledState() {
    336352            setEnabled(historyTable.getSelectedRowCount() > 0);
Note: See TracChangeset for help on using the changeset viewer.