756
757 if (inputMethod == null) {
758 throw new UnsupportedOperationException("Null input method");
759 }
760
761 String inputMethodInfo = null;
762 if (inputMethod instanceof InputMethodAdapter) {
763 // returns the information about the host native input method.
764 inputMethodInfo = ((InputMethodAdapter)inputMethod).
765 getNativeInputMethodInfo();
766 }
767
768 // extracts the information from the InputMethodDescriptor
769 // associated with the current java input method.
770 if (inputMethodInfo == null && inputMethodLocator != null) {
771 inputMethodInfo = inputMethodLocator.getDescriptor().
772 getInputMethodDisplayName(getLocale(), SunToolkit.
773 getStartupLocale());
774 }
775
776 if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
777 return inputMethodInfo;
778 }
779
780 // do our best to return something useful.
781 return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
782 }
783
784 /**
785 * Turns off the native IM. The native IM is diabled when
786 * the deactive method of InputMethod is called. It is
787 * delayed until the active method is called on a different
788 * peer component. This method is provided to explicitly disable
789 * the native IM.
790 */
791 public void disableNativeIM() {
792 InputMethod inputMethod = getInputMethod();
793 if (inputMethod != null && inputMethod instanceof InputMethodAdapter) {
794 ((InputMethodAdapter)inputMethod).stopListening();
795 }
796 }
|
756
757 if (inputMethod == null) {
758 throw new UnsupportedOperationException("Null input method");
759 }
760
761 String inputMethodInfo = null;
762 if (inputMethod instanceof InputMethodAdapter) {
763 // returns the information about the host native input method.
764 inputMethodInfo = ((InputMethodAdapter)inputMethod).
765 getNativeInputMethodInfo();
766 }
767
768 // extracts the information from the InputMethodDescriptor
769 // associated with the current java input method.
770 if (inputMethodInfo == null && inputMethodLocator != null) {
771 inputMethodInfo = inputMethodLocator.getDescriptor().
772 getInputMethodDisplayName(getLocale(), SunToolkit.
773 getStartupLocale());
774 }
775
776 if (inputMethodInfo != null && !inputMethodInfo.isEmpty()) {
777 return inputMethodInfo;
778 }
779
780 // do our best to return something useful.
781 return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
782 }
783
784 /**
785 * Turns off the native IM. The native IM is diabled when
786 * the deactive method of InputMethod is called. It is
787 * delayed until the active method is called on a different
788 * peer component. This method is provided to explicitly disable
789 * the native IM.
790 */
791 public void disableNativeIM() {
792 InputMethod inputMethod = getInputMethod();
793 if (inputMethod != null && inputMethod instanceof InputMethodAdapter) {
794 ((InputMethodAdapter)inputMethod).stopListening();
795 }
796 }
|