Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (12 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java

    r30737 r30738  
    11package iodb;
    22
    3 import java.awt.*;
     3import static org.openstreetmap.josm.tools.I18n.tr;
     4
     5import java.awt.BasicStroke;
     6import java.awt.Color;
     7import java.awt.Component;
     8import java.awt.FlowLayout;
     9import java.awt.Graphics2D;
     10import java.awt.GridLayout;
     11import java.awt.Point;
     12import java.awt.RenderingHints;
    413import java.awt.event.ActionEvent;
    514import java.awt.event.ActionListener;
     
    817import java.net.HttpURLConnection;
    918import java.net.URL;
    10 import java.util.*;
     19import java.util.ArrayList;
     20import java.util.Date;
    1121import java.util.List;
    12 import javax.swing.*;
     22
     23import javax.swing.AbstractAction;
     24import javax.swing.Box;
     25import javax.swing.BoxLayout;
     26import javax.swing.JButton;
     27import javax.swing.JCheckBox;
     28import javax.swing.JComponent;
     29import javax.swing.JDialog;
     30import javax.swing.JOptionPane;
     31import javax.swing.JPanel;
     32import javax.swing.JPopupMenu;
     33import javax.swing.KeyStroke;
    1334import javax.swing.border.CompoundBorder;
    1435import javax.swing.border.EmptyBorder;
     36
    1537import org.openstreetmap.josm.Main;
    1638import org.openstreetmap.josm.data.Bounds;
     
    1941import org.openstreetmap.josm.gui.layer.ImageryLayer;
    2042import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    21 import org.openstreetmap.josm.tools.*;
    22 import static org.openstreetmap.josm.tools.I18n.tr;
     43import org.openstreetmap.josm.tools.ImageProvider;
     44import org.openstreetmap.josm.tools.LanguageInfo;
     45import org.openstreetmap.josm.tools.OpenBrowser;
     46import org.openstreetmap.josm.tools.Utils;
    2347
    2448/**
    2549 * The dialog which presents a choice between imagery align options.
    26  * 
     50 *
    2751 * @author Zverik
    2852 * @license WTFPL
     
    3155    protected static final String PREF_CALIBRATION = "iodb.show.calibration";
    3256    protected static final String PREF_DEPRECATED = "iodb.show.deprecated";
    33     private static final int MAX_OFFSETS = Main.main.pref.getInteger("iodb.max.offsets", 4);
     57    private static final int MAX_OFFSETS = Main.pref.getInteger("iodb.max.offsets", 4);
    3458
    3559    /**
     
    4569
    4670    /**
    47      * Initialize the dialog and install listeners. 
     71     * Initialize the dialog and install listeners.
    4872     * @param offsets The list of offset to choose from.
    4973     */
     
    6084                JComponent.WHEN_IN_FOCUSED_WINDOW);
    6185    }
    62    
     86
    6387    /**
    6488     * Creates the GUI.
     
    6993        calibrationBox.setSelected(Main.pref.getBoolean(PREF_CALIBRATION, true));
    7094        calibrationBox.addActionListener(new ActionListener() {
    71             public void actionPerformed( ActionEvent e ) {
     95            @Override
     96                        public void actionPerformed( ActionEvent e ) {
    7297                Main.pref.put(PREF_CALIBRATION, calibrationBox.isSelected());
    7398                updateButtonPanel();
     
    77102        deprecatedBox.setSelected(Main.pref.getBoolean(PREF_DEPRECATED, false));
    78103        deprecatedBox.addActionListener(new ActionListener() {
    79             public void actionPerformed( ActionEvent e ) {
     104            @Override
     105                        public void actionPerformed( ActionEvent e ) {
    80106                Main.pref.put(PREF_DEPRECATED, deprecatedBox.isSelected());
    81107                updateButtonPanel();
     
    154180     * It does nothing, only passes the event to all displayed offset buttons.
    155181     */
    156     public void zoomChanged() {
     182    @Override
     183        public void zoomChanged() {
    157184        for( Component c : buttonPanel.getComponents() ) {
    158185            if( c instanceof OffsetDialogButton ) {
     
    166193     * value, but looks nice.
    167194     */
    168     public void paint( Graphics2D g, MapView mv, Bounds bbox ) {
     195    @Override
     196        public void paint( Graphics2D g, MapView mv, Bounds bbox ) {
    169197        if( offsets == null )
    170198            return;
     
    181209        }
    182210    }
    183    
     211
    184212    /**
    185213     * Display the dialog and get the return value is case of a modal frame.
     
    208236     * @see #applyOffset()
    209237     */
    210     public void actionPerformed( ActionEvent e ) {
     238    @Override
     239        public void actionPerformed( ActionEvent e ) {
    211240        if( e.getSource() instanceof OffsetDialogButton ) {
    212241            selectedOffset = ((OffsetDialogButton)e.getSource()).getOffset();
     
    283312         * Remove the deprecated offset from the offsets list. Then rebuild the button panel.
    284313         */
    285         public void queryPassed() {
     314        @Override
     315                public void queryPassed() {
    286316            offset.setDeprecated(new Date(), JosmUserIdentityManager.getInstance().getUserName(), "");
    287317            updateButtonPanel();
     
    299329        }
    300330
    301         public void actionPerformed( ActionEvent e ) {
     331        @Override
     332                public void actionPerformed( ActionEvent e ) {
    302333            String base = Main.pref.get("url.openstreetmap-wiki", "http://wiki.openstreetmap.org/wiki/");
    303334            String lang = LanguageInfo.getWikiLanguagePrefix();
Note: See TracChangeset for help on using the changeset viewer.