Ticket #15709: josm_fix-r13264-regression_imageviewerdialog-opening-two-windows-if-undocked_bugfix-variant1.patch

File josm_fix-r13264-regression_imageviewerdialog-opening-two-windows-if-undocked_bugfix-variant1.patch, 1.5 KB (added by cmuelle8, 4 months ago)

this is almost a revert of r13264, photoadjust plugin will get an Assertion error, as long as geoimage layer has not set up the imageviewer dialog instance

  • src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

     
    999999
    10001000        MapFrame map = MainApplication.getMap();
    10011001        if (map.getToggleDialog(ImageViewerDialog.class) == null) {
     1002            ImageViewerDialog.createInstance();
    10021003            map.addToggleDialog(ImageViewerDialog.getInstance());
    10031004        }
    10041005    }
  • src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

     
    5858
    5959    private boolean collapseButtonClicked;
    6060
     61    public static void createInstance() {
     62        if (dialog != null)
     63            throw new IllegalStateException("ImageViewerDialog instance was already created");
     64        dialog = new ImageViewerDialog();
     65    }
     66
    6167    /**
    6268     * Replies the unique instance of this dialog
    6369     * @return the unique instance
    6470     */
    6571    public static ImageViewerDialog getInstance() {
    6672        if (dialog == null)
    67             dialog = new ImageViewerDialog();
     73            throw new AssertionError("a new instance needs to be created first");
    6874        return dialog;
    6975    }
    7076