Ignore:
Timestamp:
2010-03-14T00:20:50+01:00 (15 years ago)
Author:
bastik
Message:

fixed josm bug 4674 - Crash when activating OSB-Layer

Location:
applications/editors/josm/plugins/openstreetbugs
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbPlugin.java

    r19463 r20463  
    7070        initConfig();
    7171        dataSet = new DataSet();
    72         uploadHook = new OsbUploadHook();
    73         dialog = new OsbDialog(this);
    74         MapView.addLayerChangeListener(dialog);
    75         MapView.addLayerChangeListener(this);
     72    }
     73
     74    @Override
     75    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
     76        if (newFrame != null) {
     77            dialog = new OsbDialog(this);
     78            newFrame.addToggleDialog(dialog);
     79
     80            MapView.addLayerChangeListener(dialog);
     81            MapView.addLayerChangeListener(this);
     82           
     83            uploadHook = new OsbUploadHook();
     84            UploadAction.registerUploadHook(uploadHook);
     85        } else {
     86                MapView.removeLayerChangeListener(this);
     87                UploadAction.unregisterUploadHook(uploadHook);
     88                uploadHook = null;
     89        }
    7690    }
    7791
     
    196210    }
    197211
    198     @Override
    199     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    200         if (oldFrame==null && newFrame!=null) { // map frame added
    201             // add the dialog
    202             newFrame.addToggleDialog(dialog);
    203 
    204             // add the upload hook
    205             UploadAction.registerUploadHook(uploadHook);
    206         } else if (oldFrame!=null && newFrame==null ) { // map frame removed
    207 
    208         }
    209     }
    210 
    211212    public static ImageIcon loadIcon(String name) {
    212213        return ImageProvider.get(name);
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java

    r19366 r20463  
    101101
    102102    public OsbDialog(final OsbPlugin plugin) {
    103         super(tr("Open OpenStreetBugs"), "icon_error22",
     103        super(tr("Open OpenStreetBugs"), "icon_error24",
    104104                tr("Opens the OpenStreetBugs window and activates the automatic download"), Shortcut.registerShortcut(
    105105                        "view:openstreetbugs", tr("Toggle: {0}", tr("Open OpenStreetBugs")), KeyEvent.VK_O,
Note: See TracChangeset for help on using the changeset viewer.