Changeset 16433 in josm


Ignore:
Timestamp:
2020-05-16T23:56:02+02:00 (3 weeks ago)
Author:
simon04
Message:

fix #18107 - ChangesetCacheManager: copy a list of changesets to clipboard

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r14231 r16433  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.osm;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.util.ArrayList;
     
    490492        discussion.add(comment);
    491493    }
     494
     495    @Override
     496    public String toString() {
     497        return tr("Changeset") + " " + id + ": " + getComment();
     498    }
    492499}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java

    r16305 r16433  
    1111import java.awt.GraphicsEnvironment;
    1212import java.awt.Window;
     13import java.awt.datatransfer.Clipboard;
    1314import java.awt.event.ActionEvent;
    1415import java.awt.event.KeyEvent;
     
    3839import javax.swing.KeyStroke;
    3940import javax.swing.ListSelectionModel;
     41import javax.swing.TransferHandler;
    4042import javax.swing.event.ListSelectionEvent;
    4143import javax.swing.event.ListSelectionListener;
     
    5456import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    5557import org.openstreetmap.josm.gui.MainApplication;
     58import org.openstreetmap.josm.gui.datatransfer.ChangesetTransferable;
     59import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    5660import org.openstreetmap.josm.gui.dialogs.changeset.query.ChangesetQueryDialog;
    5761import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
     
    280284        tblChangesets.getActionMap().put("removeFromCache", actRemoveFromCacheAction);
    281285
     286        tblChangesets.setTransferHandler(new TransferHandler() {
     287            @Override
     288            public void exportToClipboard(JComponent comp, Clipboard clip, int action) throws IllegalStateException {
     289                List<Changeset> changesets = model.getSelectedChangesets();
     290                ChangesetTransferable transferable = new ChangesetTransferable(changesets);
     291                ClipboardUtils.copy(transferable);
     292            }
     293        });
     294
    282295        pnl.add(new JScrollPane(tblChangesets), BorderLayout.CENTER);
    283296        pnl.add(buildChangesetTableActionPanel(), BorderLayout.WEST);
Note: See TracChangeset for help on using the changeset viewer.