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

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

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

File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.relation.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7
8import org.openstreetmap.josm.tools.ImageProvider;
9
10/**
11 * Selects primitives in the layer this editor belongs to. The selected primitives are
12 * equal to the set of primitives the currently selected relation members refer to.
13 * @since 9496
14 */
15public class SelectPrimitivesForSelectedMembersAction extends AbstractRelationEditorAction {
16        private static final long serialVersionUID = 1L;
17
18    /**
19     * Select objects for selected relation members.
20     * @param memberTable member table
21     * @param memberTableModel member table model
22     * @param layer layer
23     */
24    public SelectPrimitivesForSelectedMembersAction(IRelationEditorActionAccess editorAccess) {
25        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
26        putValue(SHORT_DESCRIPTION, tr("Select objects for selected relation members"));
27        new ImageProvider("dialogs/relation", "selectprimitives").getResource().attachImageIcon(this, true);
28        updateEnabledState();
29    }
30
31    @Override
32    protected void updateEnabledState() {
33        setEnabled(editorAccess.getMemberTable().getSelectedRowCount() > 0);
34    }
35
36    @Override
37    public void actionPerformed(ActionEvent e) {
38        getLayer().data.setSelected(editorAccess.getMemberTableModel().getSelectedChildPrimitives());
39    }
40}
Note: See TracBrowser for help on using the repository browser.