Changeset 4350 in josm for trunk


Ignore:
Timestamp:
2011-08-27T11:52:16+02:00 (13 years ago)
Author:
xeen
Message:

fix shortcut warnings introduced in @4333 (see #30)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r4333 r4350  
    182182    }
    183183
     184    private final Shortcut[] visibilityToggleShortcuts = new Shortcut[10];
     185    private final ToggleLayerIndexVisibility[] visibilityToggleActions = new ToggleLayerIndexVisibility[10];
    184186    /**
    185187     * registers (shortcut to toggle right hand side toggle dialogs)+(number keys) shortcuts
     
    191193                KeyEvent.VK_9, KeyEvent.VK_0 };
    192194
    193         for(int i=1; i <= 10; i++) {
    194             Main.registerActionShortcut(
    195                     new ToggleLayerIndexVisibility(i),
    196                     Shortcut.registerShortcut("subwindow:layers:toggleLayer" + i,
    197                             tr("Toggle visibility of layer: {0}", i),
    198                             k[i-1],
    199                             Shortcut.GROUP_LAYER));
     195        for(int i=0; i < 10; i++) {
     196            visibilityToggleShortcuts[i] = Shortcut.registerShortcut(
     197                    "subwindow:layers:toggleLayer" + (i+1),
     198                    tr("Toggle visibility of layer: {0}", (i+1)),
     199                    k[i],
     200                    Shortcut.GROUP_LAYER);
     201            visibilityToggleActions[i] = new ToggleLayerIndexVisibility(i);
     202            Main.registerActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]);
    200203        }
    201204    }
     
    338341    @Override
    339342    public void destroy() {
     343        for(int i=0; i < 10; i++) {
     344            Main.unregisterActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]);
     345        }
    340346        super.destroy();
    341347        instance = null;
Note: See TracChangeset for help on using the changeset viewer.