Changeset 12748 in josm


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

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

Location:
trunk/src/org/openstreetmap/josm
Files:
7 edited

Legend:

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

    r12639 r12748  
    6767import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    6868import org.openstreetmap.josm.gui.layer.NativeScaleLayer;
    69 import org.openstreetmap.josm.gui.util.GuiHelper;
    7069import org.openstreetmap.josm.gui.widgets.DisableShortcutsOnFocusGainedTextField;
    7170import org.openstreetmap.josm.gui.widgets.JosmTextField;
     
    216215        // Disable some default JTable shortcuts to use JOSM ones (see #5678, #10458)
    217216        for (KeyStroke ks : new KeyStroke[] {
    218                 KeyStroke.getKeyStroke(KeyEvent.VK_C, GuiHelper.getMenuShortcutKeyMaskEx()),
    219                 KeyStroke.getKeyStroke(KeyEvent.VK_V, GuiHelper.getMenuShortcutKeyMaskEx()),
     217                KeyStroke.getKeyStroke(KeyEvent.VK_C, Main.platform.getMenuShortcutKeyMaskEx()),
     218                KeyStroke.getKeyStroke(KeyEvent.VK_V, Main.platform.getMenuShortcutKeyMaskEx()),
    220219                KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.SHIFT_DOWN_MASK),
    221220                KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_DOWN_MASK),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r12663 r12748  
    5050import org.openstreetmap.josm.data.osm.event.DatasetEventManager;
    5151import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
    52 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    5352import org.openstreetmap.josm.data.osm.event.NodeMovedEvent;
    5453import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent;
     
    5756import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    5857import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
     58import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    5959import org.openstreetmap.josm.gui.MainApplication;
    6060import org.openstreetmap.josm.gui.MapView;
     
    7272import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    7373import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    74 import org.openstreetmap.josm.gui.util.GuiHelper;
    7574import org.openstreetmap.josm.gui.util.HighlightHelper;
    7675import org.openstreetmap.josm.gui.widgets.CompileSearchTextDecorator;
     
    183182        // Do not hide copy action because of default JList override (fix #9815)
    184183        displaylist.getActionMap().put("copy", MainApplication.getMenu().copy);
    185         displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, GuiHelper.getMenuShortcutKeyMaskEx()), "copy");
     184        displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, Main.platform.getMenuShortcutKeyMaskEx()), "copy");
    186185
    187186        updateActionsRelationLists();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r12678 r12748  
    6969import org.openstreetmap.josm.data.osm.OsmPrimitive;
    7070import org.openstreetmap.josm.data.osm.Tag;
     71import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    7172import org.openstreetmap.josm.data.osm.search.SearchParseError;
    7273import org.openstreetmap.josm.data.osm.search.SearchSetting;
    73 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    7474import org.openstreetmap.josm.data.preferences.BooleanProperty;
    7575import org.openstreetmap.josm.data.preferences.CollectionProperty;
     
    810810        @Override
    811811        public void setContentPane(Container contentPane) {
    812             final int commandDownMask = GuiHelper.getMenuShortcutKeyMaskEx();
     812            final int commandDownMask = Main.platform.getMenuShortcutKeyMaskEx();
    813813            List<String> lines = new ArrayList<>();
    814814            Shortcut.findShortcut(KeyEvent.VK_1, commandDownMask).ifPresent(sc ->
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r12644 r12748  
    6666import org.openstreetmap.josm.tools.LanguageInfo;
    6767import org.openstreetmap.josm.tools.Logging;
     68import org.openstreetmap.josm.tools.PlatformHook;
    6869import org.openstreetmap.josm.tools.bugreport.BugReport;
    6970import org.openstreetmap.josm.tools.bugreport.ReportedException;
     
    470471     * @return extended modifier key used as the appropriate accelerator key for menu shortcuts
    471472     * @since 7539
    472      */
     473     * @deprecated to be removed end of 2017. Use {@link PlatformHook#getMenuShortcutKeyMaskEx()} instead
     474     */
     475    @Deprecated
    473476    public static int getMenuShortcutKeyMaskEx() {
    474477        return Main.isPlatformOsx() ? KeyEvent.META_DOWN_MASK : KeyEvent.CTRL_DOWN_MASK;
  • 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.