source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/properties/CopyValueAction.java@ 17215

Last change on this file since 17215 was 17032, checked in by Klumbumbus, 4 years ago

Add missing icons in Tags/Membership Dialog context menu, fix icons of HelpAction and SelectInRelationListAction

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.properties;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.util.Collection;
7import java.util.Collections;
8import java.util.function.IntFunction;
9import java.util.function.Supplier;
10
11import javax.swing.JTable;
12
13import org.openstreetmap.josm.data.osm.Tagged;
14import org.openstreetmap.josm.tools.ImageProvider;
15
16/**
17 * Copy the value of the selected tag to clipboard.
18 * @since 13521
19 */
20public class CopyValueAction extends AbstractCopyAction {
21
22 /**
23 * Constructs a new {@code CopyValueAction}.
24 * @param tagTable the tag table
25 * @param keyFn a function which returns the selected key for a given row index
26 * @param objectSp a supplier which returns the selected tagged object(s)
27 */
28 public CopyValueAction(JTable tagTable, IntFunction<String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) {
29 super(tagTable, keyFn, objectSp);
30 putValue(NAME, tr("Copy Value"));
31 putValue(SHORT_DESCRIPTION, tr("Copy the value of the selected tag to clipboard"));
32 new ImageProvider("copy").getResource().attachImageIcon(this, true);
33 }
34
35 @Override
36 protected Collection<String> getString(Tagged p, String key) {
37 String v = p.get(key);
38 return v == null ? null : Collections.singleton(v);
39 }
40}
Note: See TracBrowser for help on using the repository browser.