source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtEndAction.java @ 14030

Last change on this file since 14030 was 14030, checked in by michael2402, 8 months ago

See #16388: Fix Checkstyle / Test issues.

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.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
9import org.openstreetmap.josm.tools.ImageProvider;
10import org.openstreetmap.josm.tools.Logging;
11
12/**
13 * Add all objects selected in the current dataset after the last member.
14 * @since 9496
15 */
16public class AddSelectedAtEndAction extends AddFromSelectionAction {
17    private static final long serialVersionUID = 1L;
18
19    /**
20     * Constructs a new {@code AddSelectedAtEndAction}.
21     * @param editorAccess An interface to access the relation editor contents.
22     */
23    public AddSelectedAtEndAction(IRelationEditorActionAccess editorAccess) {
24        super(editorAccess, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE);
25        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset after the last member"));
26        new ImageProvider("dialogs/conflict", "copyendright").getResource().attachImageIcon(this, true);
27        updateEnabledState();
28    }
29
30    @Override
31    protected void updateEnabledState() {
32        setEnabled(getSelectionTableModel().getRowCount() > 0);
33    }
34
35    @Override
36    public void actionPerformed(ActionEvent e) {
37        try {
38            getMemberTableModel().addMembersAtEnd(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
39        } catch (AddAbortException ex) {
40            Logging.trace(ex);
41        }
42    }
43}
Note: See TracBrowser for help on using the repository browser.