Ignore:
Timestamp:
2017-04-12T21:29:51+02:00 (8 years ago)
Author:
donvip
Message:

fix #josm14062

Location:
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageChangeListener.java

    r33228 r33229  
    1414        final ImageEntries entries) {
    1515        this.dialog.imageDisplay.setImage(entries.getCurrentImage());
    16         this.dialog.updateUI();
     16        this.dialog.updateGUI();
    1717    }
    1818
     
    2020    public void onSelectedImageEntryChanged(final ImageEntries entries) {
    2121        this.dialog.imageDisplay.setImage(entries.getCurrentImage());
    22         this.dialog.updateUI();
     22        this.dialog.updateGUI();
    2323    }
    2424}
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointDialog.java

    r33228 r33229  
    1919import org.openstreetmap.josm.tools.Shortcut;
    2020
    21 public final class ImageWayPointDialog {
    22     private static final ImageWayPointDialog INSTANCE = new ImageWayPointDialog();
    23     private final ToggleDialog dialog;
     21public final class ImageWayPointDialog extends ToggleDialog {
    2422    final ImageComponent imageDisplay;
    2523    private final Action previousAction;
     
    3028    private final IImageChangeListener listener;
    3129
    32     private ImageWayPointDialog() {
    33         this.dialog = new ToggleDialog(tr("WayPoint Image"),
    34             "imagewaypoint",
    35             tr("Display non-geotagged photos"),
     30    public ImageWayPointDialog() {
     31        super(tr("WayPoint Image"), "imagewaypoint", tr("Display non-geotagged photos"),
    3632            Shortcut.registerShortcut("subwindow:imagewaypoint", tr("Toggle: {0}", tr("WayPoint Image")),
    37             KeyEvent.VK_Y, Shortcut.ALT_SHIFT),
    38             200);
     33            KeyEvent.VK_Y, Shortcut.ALT_SHIFT), 200);
    3934
    4035        this.previousAction = new PreviousAction();
     
    6560        ImageEntries.getInstance().addListener(this.listener);
    6661
    67         this.updateUI();
    68         dialog.add(mainPanel);
     62        this.updateGUI();
     63        add(mainPanel);
    6964    }
    7065
    71     void updateUI() {
     66    void updateGUI() {
    7267        this.previousAction.setEnabled(ImageEntries.getInstance().hasPrevious());
    7368        this.nextAction.setEnabled(ImageEntries.getInstance().hasNext());
    74         this.rotateLeftAction.setEnabled(null != ImageEntries.getInstance()
    75             .getCurrentImageEntry());
    76         this.rotateRightAction.setEnabled(null != ImageEntries.getInstance()
    77             .getCurrentImageEntry());
     69        this.rotateLeftAction.setEnabled(null != ImageEntries.getInstance().getCurrentImageEntry());
     70        this.rotateRightAction.setEnabled(null != ImageEntries.getInstance().getCurrentImageEntry());
    7871
    7972        if (null != Main.map) {
     
    8174        }
    8275    }
    83 
    84     public static ImageWayPointDialog getInstance() {
    85         return ImageWayPointDialog.INSTANCE;
    86     }
    87 
    88     public ToggleDialog getDisplayComponent() {
    89         return this.dialog;
    90     }
    9176}
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java

    r33086 r33229  
    88import java.util.Iterator;
    99import java.util.List;
     10import java.util.Locale;
    1011
    1112import org.openstreetmap.josm.Main;
     
    5758                }
    5859                if (!foundImageWayPointLayer) {
    59                     GuiHelper.runInEDT(new Runnable() {
    60                         @Override
    61                         public void run() {
    62                             new ImageWayPointLayer();
    63                         }
    64                     });
     60                    GuiHelper.runInEDT(ImageWayPointLayer::new);
    6561                }
    6662            }
     
    7975    public void mapFrameInitialized(final MapFrame oldFrame, final MapFrame newFrame) {
    8076        if (newFrame != null) {
    81             newFrame.addToggleDialog(ImageWayPointDialog.getInstance()
    82             .getDisplayComponent());
     77            newFrame.addToggleDialog(new ImageWayPointDialog());
    8378        } else {
    8479            ImageEntries.getInstance().setCurrentImageEntry(null);
     
    9085            final File selectedFile = selectedFiles[index];
    9186            if (selectedFile.isDirectory())
    92               this.addFiles(allFiles, selectedFile.listFiles());
    93             else if (selectedFile.getName().toLowerCase().endsWith(".jpg"))
    94               allFiles.add(selectedFile);
     87                this.addFiles(allFiles, selectedFile.listFiles());
     88            else if (selectedFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".jpg"))
     89                allFiles.add(selectedFile);
    9590        }
    9691    }
Note: See TracChangeset for help on using the changeset viewer.