001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.actions; 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.preferences.display.DrawingPreference; 010 011/** 012 * This class toggles whether to draw boundaries of downloaded data. 013 * 014 * @since 14648 015 */ 016public class DrawBoundariesOfDownloadedDataAction extends PreferenceToggleAction { 017 018 /** 019 * Constructs a new {@link DrawBoundariesOfDownloadedDataAction}. 020 */ 021 public DrawBoundariesOfDownloadedDataAction() { 022 super(tr("Draw boundaries of downloaded data"), 023 tr("Enable/disable hatched background rendering of areas outside of the downloaded areas."), 024 DrawingPreference.SOURCE_BOUNDS_PROP.getKey(), 025 DrawingPreference.SOURCE_BOUNDS_PROP.getDefaultValue() 026 ); 027 } 028 029 @Override 030 protected void updateEnabledState() { 031 setEnabled(MainApplication.getLayerManager().getEditLayer() != null); 032 } 033 034 @Override 035 public void actionPerformed(ActionEvent e) { 036 super.actionPerformed(e); 037 if (MainApplication.isDisplayingMapView()) { 038 MainApplication.getMap().mapView.repaint(); 039 } 040 } 041 042}