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

Last change on this file since 13849 was 13849, checked in by Don-vip, 6 years ago

SonarQube - fix minor code issues

  • Property svn:eol-style set to native
File size: 1.2 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;
14
15/**
16 * Copy the value of the selected tag to clipboard.
17 * @since 13521
18 */
19public class CopyValueAction extends AbstractCopyAction {
20
21 /**
22 * Constructs a new {@code CopyValueAction}.
23 * @param tagTable the tag table
24 * @param keyFn a function which returns the selected key for a given row index
25 * @param objectSp a supplier which returns the selected tagged object(s)
26 */
27 public CopyValueAction(JTable tagTable, IntFunction<String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) {
28 super(tagTable, keyFn, objectSp);
29 putValue(NAME, tr("Copy Value"));
30 putValue(SHORT_DESCRIPTION, tr("Copy the value of the selected tag to clipboard"));
31 }
32
33 @Override
34 protected Collection<String> getString(Tagged p, String key) {
35 String v = p.get(key);
36 return v == null ? null : Collections.singleton(v);
37 }
38}
Note: See TracBrowser for help on using the repository browser.