--- old/makefiles/GensrcProperties.gmk 2013-09-11 13:21:28.000000000 +0400 +++ new/makefiles/GensrcProperties.gmk 2013-09-11 13:21:28.000000000 +0400 @@ -253,6 +253,13 @@ $(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\ ListResourceBundle,%zh_TW,%zh_HK)) endif +# os x specific awt properties +ifeq ($(OPENJDK_TARGET_OS),macosx) +$(eval $(call add_properties_to_compile,SUN_AWT,\ + $(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\ + $(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\ + ListResourceBundle)) +endif #sun/launcher/resources $(eval $(call add_properties_to_compile,SUN_LAUNCHER,\ --- old/src/share/classes/java/awt/Toolkit.java 2013-09-11 13:21:29.000000000 +0400 +++ new/src/share/classes/java/awt/Toolkit.java 2013-09-11 13:21:29.000000000 +0400 @@ -1607,6 +1607,8 @@ * here, so that only one copy is maintained. */ private static ResourceBundle resources; + private static ResourceBundle platformResources; + /** * Initialize JNI field and method ids @@ -1655,6 +1657,15 @@ } static { + String osname = System.getProperty("os.name"); + + final String platformSuffix; + if (osname.contains("OS X")) { + platformSuffix = "osx"; + } else { + platformSuffix = null; + } + java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { public Void run() { @@ -1662,6 +1673,12 @@ resources = ResourceBundle.getBundle("sun.awt.resources.awt", CoreResourceBundleControl.getRBControlInstance()); + if (platformSuffix != null) { + platformResources = + ResourceBundle.getBundle("sun.awt.resources.awt" + platformSuffix, + CoreResourceBundleControl.getRBControlInstance()); + } + } catch (MissingResourceException e) { // No resource file; defaults will be used. } @@ -1682,6 +1699,15 @@ * This method returns defaultValue if the property is not found. */ public static String getProperty(String key, String defaultValue) { + // first try platform specific bundle + if (platformResources != null) { + try { + return platformResources.getString(key); + } + catch (MissingResourceException e) {} + } + + // then shared one if (resources != null) { try { return resources.getString(key); --- /dev/null 2013-09-11 13:21:29.000000000 +0400 +++ new/src/macosx/classes/sun/awt/resources/awtosx.properties 2013-09-11 13:21:29.000000000 +0400 @@ -0,0 +1,71 @@ +# +# OS X specific AWT properties +# + +# Modifier names +AWT.shift=\u21e7 +AWT.control=\u2303 +AWT.alt=\u2325 +AWT.meta=\u2318 +AWT.altGraph=\u2325 + +# Key names +AWT.enter=\u23ce +AWT.backSpace=\u232b +AWT.tab=\u21e5 +AWT.cancel=\u238b +AWT.clear=\u2327 +AWT.capsLock=\u21ea +AWT.escape=\u238b +AWT.space=\u2423 +AWT.pgup=\u21de +AWT.pgdn=\u21df +AWT.end=\u2198 +AWT.home=\u2196 +AWT.left=\u2190 +AWT.up=\u2191 +AWT.right=\u2192 +AWT.down=\u2193 +AWT.comma=, +AWT.period=. +AWT.slash=/ +AWT.semicolon=; +AWT.equals=\u003d +AWT.openBracket=[ +AWT.backSlash=\\ +AWT.closeBracket=] +AWT.multiply=\u2328 * +AWT.add=\u2328 + +AWT.separator=\u2328 , +AWT.separater=\u2328 , +AWT.subtract=\u2328 - +AWT.decimal=\u2328 . +AWT.divide=\u2328 / +AWT.delete=\u2326 +AWT.printScreen=\u2399 +AWT.backQuote=` +AWT.quote=' +AWT.ampersand=& +AWT.asterisk=* +AWT.quoteDbl=" +AWT.Less=< +AWT.greater=> +AWT.braceLeft=[ +AWT.braceRight=] +AWT.at=@ +AWT.colon=: +AWT.circumflex=^ +AWT.dollar=$ +AWT.euro=\u20ac +AWT.exclamationMark=! +AWT.invertedExclamationMark=\u00a1 +AWT.leftParenthesis=( +AWT.numberSign=# +AWT.plus=+ +AWT.minus=- +AWT.rightParenthesis=) +AWT.underscore=_ + +# Numeric Keypad +AWT.numpad=\u2328 + --- /dev/null 2013-09-11 13:21:30.000000000 +0400 +++ new/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java 2013-09-11 13:21:30.000000000 +0400 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7129133 + * @summary [macosx] Accelerators are displayed as Meta instead of the Command symbol + * @author leonid.romanov@oracle.com + * @run main bug7129133 + */ + +import java.awt.*; + +public class bug7129133 { + public static void main(String[] args) throws Exception { + if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + System.out.println("This test is for MacOS only. Automatically passed on other platforms."); + return; + } + + String cmdSymbol = "\u2318"; + String val = Toolkit.getProperty("AWT.meta", "Meta"); + + if (!val.equals(cmdSymbol)) { + throw new Exception("Wrong property value for AWT.meta. Expected: " + cmdSymbol + ", actual: " + val); + } + } +}