source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CopyMembersAction.java @ 14027

Last change on this file since 14027 was 14027, checked in by michael2402, 3 months ago

See #16388: New mechanism for plugins to register relation editor actions.

File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.relation.actions;
3
4import java.awt.event.ActionEvent;
5import java.util.Collection;
6
7import org.openstreetmap.josm.data.osm.RelationMember;
8import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
9import org.openstreetmap.josm.gui.datatransfer.RelationMemberTransferable;
10
11/**
12 * Copy members.
13 * @since 9496
14 */
15public class CopyMembersAction extends AddFromSelectionAction {
16        private static final long serialVersionUID = 1L;
17
18    /**
19     * Constructs a new {@code CopyMembersAction}.
20     * @param memberTableModel member table model
21     * @param layer OSM data layer
22     * @param editor relation editor
23     */
24    public CopyMembersAction(IRelationEditorActionAccess editorAccess) {
25        super(editorAccess);
26    }
27
28    @Override
29    public void actionPerformed(ActionEvent e) {
30        final Collection<RelationMember> members = getMemberTableModel().getSelectedMembers();
31
32        if (!members.isEmpty()) {
33            ClipboardUtils.copy(new RelationMemberTransferable(members));
34        }
35    }
36
37    @Override
38    protected void updateEnabledState() {
39        // Do nothing
40    }
41}
Note: See TracBrowser for help on using the repository browser.