001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.actions.relation; 003 004import static org.openstreetmap.josm.tools.I18n.tr; 005 006import java.awt.event.ActionEvent; 007 008import org.openstreetmap.josm.gui.MainApplication; 009import org.openstreetmap.josm.gui.MapFrame; 010import org.openstreetmap.josm.tools.ImageProvider; 011 012/** 013 * The action for activating a relation in relation list dialog 014 * @since 5793 015 */ 016public class SelectInRelationListAction extends AbstractRelationAction { 017 018 /** 019 * Constructs a new <code>SelectInRelationListAction</code>. 020 */ 021 public SelectInRelationListAction() { 022 putValue(NAME, tr("Select in relation list")); 023 putValue(SHORT_DESCRIPTION, tr("Select relation in relation list.")); 024 new ImageProvider("dialogs", "selectionlist").getResource().attachImageIcon(this, true); 025 } 026 027 @Override 028 public void actionPerformed(ActionEvent e) { 029 MapFrame map = MainApplication.getMap(); 030 if (!isEnabled() || relations.isEmpty() || map == null || map.relationListDialog == null) return; 031 map.relationListDialog.unfurlDialog(); 032 map.relationListDialog.selectRelations(relations); 033 } 034}