< prev index next >
src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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. Oracle designates this
@@ -55,19 +55,23 @@
System.arraycopy(locales, 0, tmp, 0, locales.length);
return tmp;
}
static Object[] getAvailableLocalesInternal() {
- List<?> workList = nativeGetAvailableLocales();
-
- if (workList != null) {
- return workList.toArray();
- }
+ List<Object> workList = nativeGetAvailableLocales();
+ Locale currentLocale = CInputMethod.getNativeLocale();
+ if (workList == null || (workList != null && workList.isEmpty())) {
return new Object[] {
- Locale.getDefault()
+ currentLocale != null ? currentLocale : Locale.getDefault()
};
+ } else {
+ if (currentLocale != null && !workList.contains(currentLocale)) {
+ workList.add(currentLocale);
+ }
+ return workList.toArray();
+ }
}
/**
* @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList
*/
@@ -117,7 +121,7 @@
",localelist=" + (hasDynamicLocaleList() ? "dynamic" : "static") +
"]";
}
private static native void nativeInit();
- private static native List<?> nativeGetAvailableLocales();
+ private static native List<Object> nativeGetAvailableLocales();
}
< prev index next >