Ignore:
Timestamp:
2017-09-06T01:08:48+02:00 (2 years ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - deprecate GuiHelper.getMenuShortcutKeyMaskEx() - replaced by PlatformHook.getMenuShortcutKeyMaskEx()

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHook.java

    r12695 r12748  
    33
    44import java.awt.GraphicsEnvironment;
     5import java.awt.Toolkit;
     6import java.awt.event.KeyEvent;
    57import java.io.BufferedReader;
    68import java.io.File;
     
    242244
    243245    /**
     246     * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts.
     247     * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:
     248     * <ul>
     249     * <li>it returns KeyEvent.CTRL_MASK instead of KeyEvent.CTRL_DOWN_MASK. We used the extended
     250     *    modifier for years, and Oracle recommends to use it instead, so it's best to keep it</li>
     251     * <li>the method throws a HeadlessException ! So we would need to handle it for unit tests anyway</li>
     252     * </ul>
     253     * @return extended modifier key used as the appropriate accelerator key for menu shortcuts
     254     * @since 12748 (as a replacement to {@code GuiHelper.getMenuShortcutKeyMaskEx()})
     255     */
     256    default int getMenuShortcutKeyMaskEx() {
     257        return KeyEvent.CTRL_DOWN_MASK;
     258    }
     259
     260    /**
    244261     * Called when an outdated version of Java is detected at startup.
    245262     * @since 12270
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r12697 r12748  
    7676        }
    7777        checkExpiredJava(callback);
     78    }
     79
     80    @Override
     81    public int getMenuShortcutKeyMaskEx() {
     82        return KeyEvent.META_DOWN_MASK;
    7883    }
    7984
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r12620 r12748  
    2323
    2424import org.openstreetmap.josm.Main;
    25 import org.openstreetmap.josm.gui.util.GuiHelper;
    2625
    2726/**
     
    370369        if (initdone) return;
    371370        initdone = true;
    372         int commandDownMask = GuiHelper.getMenuShortcutKeyMaskEx();
     371        int commandDownMask = Main.platform.getMenuShortcutKeyMaskEx();
    373372        groups.put(NONE, -1);
    374373        groups.put(MNEMONIC, KeyEvent.ALT_DOWN_MASK);
Note: See TracChangeset for help on using the changeset viewer.