diff options
author | Grant Gayed <ggayed> | 2006-03-16 20:46:34 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2006-03-16 20:46:34 +0000 |
commit | cef5bd1a247a5c315d365f197b72d292f04814a2 (patch) | |
tree | 8103d9453ef537886eae46a5d643db53c328fb08 | |
parent | 6827e7561886a98908d3b58e22819238a237e195 (diff) | |
download | eclipse.platform.swt-cef5bd1a247a5c315d365f197b72d292f04814a2.tar.gz eclipse.platform.swt-cef5bd1a247a5c315d365f197b72d292f04814a2.tar.xz eclipse.platform.swt-cef5bd1a247a5c315d365f197b72d292f04814a2.zip |
77456
9 files changed, 459 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties index d90528664b..05c59534a7 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties @@ -541,6 +541,13 @@ XPCOM_VtblCall__II_3BJ_1= XPCOM_VtblCall__II_3BJ_2= XPCOM_VtblCall__II_3BJ_3= +XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I= +XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_0= +XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_1= +XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_2= +XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_3= +XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_4= + XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I= XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I_0= XPCOM_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I_1= @@ -572,6 +579,12 @@ XPCOM_VtblCall__II_3BZ_3I_3Z_3= XPCOM_VtblCall__II_3BZ_3I_3Z_4= XPCOM_VtblCall__II_3BZ_3I_3Z_5= +XPCOM_VtblCall__II_3B_3B= +XPCOM_VtblCall__II_3B_3B_0= +XPCOM_VtblCall__II_3B_3B_1= +XPCOM_VtblCall__II_3B_3B_2= +XPCOM_VtblCall__II_3B_3B_3= + XPCOM_VtblCall__II_3B_3BZ= XPCOM_VtblCall__II_3B_3BZ_0= XPCOM_VtblCall__II_3B_3BZ_1= @@ -602,6 +615,13 @@ XPCOM_VtblCall__II_3B_3I_1= XPCOM_VtblCall__II_3B_3I_2= XPCOM_VtblCall__II_3B_3I_3= +XPCOM_VtblCall__II_3B_3I_3I= +XPCOM_VtblCall__II_3B_3I_3I_0= +XPCOM_VtblCall__II_3B_3I_3I_1= +XPCOM_VtblCall__II_3B_3I_3I_2= +XPCOM_VtblCall__II_3B_3I_3I_3= +XPCOM_VtblCall__II_3B_3I_3I_4= + XPCOM_VtblCall__II_3B_3I_3Z= XPCOM_VtblCall__II_3B_3I_3Z_0= XPCOM_VtblCall__II_3B_3I_3Z_1= @@ -891,6 +911,12 @@ org_eclipse_swt_internal_mozilla_nsILocalFile= org_eclipse_swt_internal_mozilla_nsIMemory= +org_eclipse_swt_internal_mozilla_nsIPrefBranch= + +org_eclipse_swt_internal_mozilla_nsIPrefLocalizedString= + +org_eclipse_swt_internal_mozilla_nsIPrefService= + org_eclipse_swt_internal_mozilla_nsIProfile= org_eclipse_swt_internal_mozilla_nsIProgressDialog= diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp index c148a01dde..2998b34af4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp @@ -1265,6 +1265,25 @@ fail: } #endif +#ifndef NO_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I +JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jobject arg3, jint arg4) +{ + jbyte *lparg2=NULL; + nsID _arg3, *lparg3=NULL; + jint rc = 0; + XPCOM_NATIVE_ENTER(env, that, VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_FUNC); + if (arg2) if ((lparg2 = env->GetByteArrayElements(arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = getnsIDFields(env, arg3, &_arg3)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jint, jbyte *, nsID *, jint))(*(jint **)arg1)[arg0])(arg1, lparg2, lparg3, arg4); +fail: + if (arg3 && lparg3) setnsIDFields(env, arg3, lparg3); + if (arg2 && lparg2) env->ReleaseByteArrayElements(arg2, lparg2, 0); + XPCOM_NATIVE_EXIT(env, that, VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_FUNC); + return rc; +} +#endif + #ifndef NO_VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I) (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jobject arg3, jintArray arg4) @@ -1353,6 +1372,25 @@ fail: } #endif +#ifndef NO_VtblCall__II_3B_3B +JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__II_3B_3B) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jbyteArray arg3) +{ + jbyte *lparg2=NULL; + jbyte *lparg3=NULL; + jint rc = 0; + XPCOM_NATIVE_ENTER(env, that, VtblCall__II_3B_3B_FUNC); + if (arg2) if ((lparg2 = env->GetByteArrayElements(arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = env->GetByteArrayElements(arg3, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jint, jbyte *, jbyte *))(*(jint **)arg1)[arg0])(arg1, lparg2, lparg3); +fail: + if (arg3 && lparg3) env->ReleaseByteArrayElements(arg3, lparg3, 0); + if (arg2 && lparg2) env->ReleaseByteArrayElements(arg2, lparg2, 0); + XPCOM_NATIVE_EXIT(env, that, VtblCall__II_3B_3B_FUNC); + return rc; +} +#endif + #ifndef NO_VtblCall__II_3B_3BZ JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__II_3B_3BZ) (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jbyteArray arg3, jboolean arg4) @@ -1438,6 +1476,28 @@ fail: } #endif +#ifndef NO_VtblCall__II_3B_3I_3I +JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__II_3B_3I_3I) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jintArray arg3, jintArray arg4) +{ + jbyte *lparg2=NULL; + jint *lparg3=NULL; + jint *lparg4=NULL; + jint rc = 0; + XPCOM_NATIVE_ENTER(env, that, VtblCall__II_3B_3I_3I_FUNC); + if (arg2) if ((lparg2 = env->GetByteArrayElements(arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = env->GetIntArrayElements(arg3, NULL)) == NULL) goto fail; + if (arg4) if ((lparg4 = env->GetIntArrayElements(arg4, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jint, jbyte *, jint *, jint *))(*(jint **)arg1)[arg0])(arg1, lparg2, lparg3, lparg4); +fail: + if (arg4 && lparg4) env->ReleaseIntArrayElements(arg4, lparg4, 0); + if (arg3 && lparg3) env->ReleaseIntArrayElements(arg3, lparg3, 0); + if (arg2 && lparg2) env->ReleaseByteArrayElements(arg2, lparg2, 0); + XPCOM_NATIVE_EXIT(env, that, VtblCall__II_3B_3I_3I_FUNC); + return rc; +} +#endif + #ifndef NO_VtblCall__II_3B_3I_3Z JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__II_3B_3I_3Z) (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jintArray arg3, jbooleanArray arg4) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp index 976a436de8..bf62ac9800 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp @@ -31,8 +31,8 @@ #ifdef NATIVE_STATS -int XPCOM_nativeFunctionCount = 127; -int XPCOM_nativeFunctionCallCount[127]; +int XPCOM_nativeFunctionCount = 130; +int XPCOM_nativeFunctionCallCount[130]; char * XPCOM_nativeFunctionNames[] = { "Call", "NS_1GetComponentManager", @@ -106,14 +106,17 @@ char * XPCOM_nativeFunctionNames[] = { "VtblCall__II_3BILorg_eclipse_swt_internal_mozilla_nsID_2_3I", "VtblCall__II_3BI_3I", "VtblCall__II_3BJ", + "VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I", "VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I", "VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3Z", "VtblCall__II_3BZI_3I_3Z", "VtblCall__II_3BZ_3I_3Z", + "VtblCall__II_3B_3B", "VtblCall__II_3B_3BZ", "VtblCall__II_3B_3B_3BZZ_3I", "VtblCall__II_3B_3B_3I", "VtblCall__II_3B_3I", + "VtblCall__II_3B_3I_3I", "VtblCall__II_3B_3I_3Z", "VtblCall__II_3B_3J", "VtblCall__II_3B_3Z", diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h index 04ff8283c1..42469dd4f3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h @@ -110,14 +110,17 @@ typedef enum { VtblCall__II_3BILorg_eclipse_swt_internal_mozilla_nsID_2_3I_FUNC, VtblCall__II_3BI_3I_FUNC, VtblCall__II_3BJ_FUNC, + VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2I_FUNC, VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3I_FUNC, VtblCall__II_3BLorg_eclipse_swt_internal_mozilla_nsID_2_3Z_FUNC, VtblCall__II_3BZI_3I_3Z_FUNC, VtblCall__II_3BZ_3I_3Z_FUNC, + VtblCall__II_3B_3B_FUNC, VtblCall__II_3B_3BZ_FUNC, VtblCall__II_3B_3B_3BZZ_3I_FUNC, VtblCall__II_3B_3B_3I_FUNC, VtblCall__II_3B_3I_FUNC, + VtblCall__II_3B_3I_3I_FUNC, VtblCall__II_3B_3I_3Z_FUNC, VtblCall__II_3B_3J_FUNC, VtblCall__II_3B_3Z_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java index bed81fa37e..1f9ec76ff9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java @@ -55,6 +55,7 @@ public class XPCOM extends Platform { public static final String NS_PROFILE_CONTRACTID = "@mozilla.org/profile/manager;1"; //$NON-NLS-1$ public static final String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1"; //$NON-NLS-1$ public static final String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$ + public static final String NS_PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1"; //$NON-NLS-1$ public static final String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$ public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$ public static final String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$ @@ -216,4 +217,7 @@ static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0) static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, boolean arg2); static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, int /*long*/[] arg2); static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, byte[] arg2, boolean arg3, boolean arg4, int /*long*/[] arg5); -}
\ No newline at end of file +static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1); +static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1, int /*long*/[] arg2); +static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, int /*long*/ arg2); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java new file mode 100755 index 0000000000..84dc4c4015 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java @@ -0,0 +1,123 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2003 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIPrefBranch extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 18; + + public static final String NS_IPREFBRANCH_IID_STR = + "56c35506-f14b-11d3-99d3-ddbfac2ccf65"; + + public static final nsID NS_IPREFBRANCH_IID = + new nsID(NS_IPREFBRANCH_IID_STR); + + public nsIPrefBranch(int /*long*/ address) { + super(address); + } + + public static final int PREF_INVALID = 0; + + public static final int PREF_STRING = 32; + + public static final int PREF_INT = 64; + + public static final int PREF_BOOL = 128; + + public int GetRoot(int /*long*/[] aRoot) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aRoot); + } + + public int GetPrefType(byte[] aPrefName, int[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aPrefName, _retval); + } + + public int GetBoolPref(byte[] aPrefName, boolean[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aPrefName, _retval); + } + + public int SetBoolPref(byte[] aPrefName, int aValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aPrefName, aValue); + } + + public int GetCharPref(byte[] aPrefName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aPrefName, _retval); + } + + public int SetCharPref(byte[] aPrefName, byte[] aValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aPrefName, aValue); + } + + public int GetIntPref(byte[] aPrefName, int[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aPrefName, _retval); + } + + public int SetIntPref(byte[] aPrefName, int aValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aPrefName, aValue); + } + + public int GetComplexValue(byte[] aPrefName, nsID aType, int /*long*/[] aValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPrefName, aType, aValue); + } + + public int SetComplexValue(byte[] aPrefName, nsID aType, int /*long*/ aValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aPrefName, aType, aValue); + } + + public int ClearUserPref(byte[] aPrefName) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aPrefName); + } + + public int LockPref(byte[] aPrefName) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aPrefName); + } + + public int PrefHasUserValue(byte[] aPrefName, boolean[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aPrefName, _retval); + } + + public int PrefIsLocked(byte[] aPrefName, boolean[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aPrefName, _retval); + } + + public int UnlockPref(byte[] aPrefName) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aPrefName); + } + + public int DeleteBranch(byte[] aStartingAt) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aStartingAt); + } + + public int GetChildList(byte[] aStartingAt, int[] aCount, int /*long*/[] aChildArray) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aStartingAt, aCount, aChildArray); + } + + public int ResetBranch(byte[] aStartingAt) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aStartingAt); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefLocalizedString.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefLocalizedString.java new file mode 100755 index 0000000000..92ff7348ee --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefLocalizedString.java @@ -0,0 +1,59 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2003 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIPrefLocalizedString extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; + + public static final String NS_IPREFLOCALIZEDSTRING_IID_STR = + "ae419e24-1dd1-11b2-b39a-d3e5e7073802"; + + public static final nsID NS_IPREFLOCALIZEDSTRING_IID = + new nsID(NS_IPREFLOCALIZEDSTRING_IID_STR); + + public nsIPrefLocalizedString(int /*long*/ address) { + super(address); + } + + public int GetData(int /*long*/[] aData) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aData); + } + + public int SetData(char[] aData) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aData); + } + + public int ToString(int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), _retval); + } + + public int SetDataWithLength(int length, char[] data) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), length, data); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefService.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefService.java new file mode 100755 index 0000000000..2911fd62d1 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPrefService.java @@ -0,0 +1,94 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2003 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2003 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIPrefService extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 6; + + public static final String NS_IPREFSERVICE_IID_STR = + "decb9cc7-c08f-4ea5-be91-a8fc637ce2d2"; + + public static final nsID NS_IPREFSERVICE_IID = + new nsID(NS_IPREFSERVICE_IID_STR); + + public nsIPrefService(int /*long*/ address) { + super(address); + } + + public int ReadUserPrefs(int /*long*/ aFile) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aFile); + } + + public int ResetPrefs() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); + } + + public int ResetUserPrefs() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); + } + + public int SavePrefFile(int /*long*/ aFile) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aFile); + } + + public int GetBranch(byte[] aPrefRoot, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aPrefRoot, _retval); + } + + public int GetDefaultBranch(byte[] aPrefRoot, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aPrefRoot, _retval); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java index 4cde4add8c..49b92ba733 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java @@ -11,6 +11,7 @@ package org.eclipse.swt.browser; import java.io.*; +import java.util.*; import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.graphics.*; @@ -76,10 +77,13 @@ public class Browser extends Composite { /* Package Name */ static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$ - static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget"; + static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget"; //$NON-NLS-1$ static final String NO_INPUT_METHOD = "org.eclipse.swt.internal.gtk.noInputMethod"; //$NON-NLS-1$ static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$ static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$ + static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$ + static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$ + static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$ static final int STOP_PROPOGATE = 1; /** * Constructs a new instance of this class given its parent @@ -195,17 +199,92 @@ public Browser(Composite parent, int style) { rc = serviceManager.GetServiceByContractID(aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result); if (rc != XPCOM.NS_OK) error(rc); if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); - serviceManager.Release(); - + nsIWindowWatcher windowWatcher = new nsIWindowWatcher(result[0]); result[0] = 0; rc = windowWatcher.SetWindowCreator(WindowCreator.getAddress()); if (rc != XPCOM.NS_OK) error(rc); windowWatcher.Release(); - + + /* + * As a result of not using profiles, the user's locale defaults + * to en_us, which is not the correct value for users in other + * locales. The fix for this is to set mozilla's locale preference + * value according to the user's current locale. + */ + buffer = XPCOM.NS_PREFSERVICE_CONTRACTID.getBytes(); + aContractID = new byte[buffer.length + 1]; + System.arraycopy(buffer, 0, aContractID, 0, buffer.length); + rc = serviceManager.GetServiceByContractID(aContractID, nsIPrefService.NS_IPREFSERVICE_IID, result); + serviceManager.Release(); + if (rc != XPCOM.NS_OK) error(rc); + if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); + + nsIPrefService prefService = new nsIPrefService(result[0]); + result[0] = 0; + buffer = new byte[1]; + rc = prefService.GetBranch(buffer, result); /* empty buffer denotes root preference level */ + prefService.Release(); + if (rc != XPCOM.NS_OK) error(rc); + if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); + + nsIPrefBranch prefBranch = new nsIPrefBranch(result[0]); + result[0] = 0; + buffer = Converter.wcsToMbcs(null, PREFERENCE_LANGUAGES, true); + rc = prefBranch.GetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result); + if (rc != XPCOM.NS_OK) error(rc); + if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); + + /* get Mozilla's current locale preference value */ + nsIPrefLocalizedString localizedString = new nsIPrefLocalizedString(result[0]); + result[0] = 0; + rc = localizedString.ToString(result); + if (rc != XPCOM.NS_OK) error(rc); + if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); + int length = XPCOM.strlen_PRUnichar(result[0]); + char[] dest = new char[length]; + XPCOM.memmove(dest, result[0], length * 2); + String prefLocales = new String(dest) + TOKENIZER_LOCALE; + + /* + * construct the new locale preference value by prepending the + * user's current locale and language to the original value + */ + Locale locale = java.util.Locale.getDefault(); + String language = locale.getLanguage(); + String country = locale.getCountry(); + StringBuffer stringBuffer = new StringBuffer (language); + stringBuffer.append(SEPARATOR_LOCALE); + stringBuffer.append(country.toLowerCase()); + stringBuffer.append(TOKENIZER_LOCALE); + stringBuffer.append(language); + stringBuffer.append(TOKENIZER_LOCALE); + String newLocales = stringBuffer.toString(); + StringTokenizer tokenzier = new StringTokenizer(prefLocales, TOKENIZER_LOCALE); + while (tokenzier.hasMoreTokens()) { + String token = (tokenzier.nextToken() + TOKENIZER_LOCALE).trim(); + /* ensure that duplicate locale values are not added */ + if (newLocales.indexOf(token) == -1) { + stringBuffer.append(token); + } + } + newLocales = stringBuffer.toString(); + if (!newLocales.equals(prefLocales)) { + /* write the new value */ + newLocales = newLocales.substring(0, newLocales.length() - TOKENIZER_LOCALE.length ()); /* remove trailing tokenizer */ + length = newLocales.length(); + char[] charBuffer = new char[length + 1]; + newLocales.getChars(0, length, charBuffer, 0); + localizedString.SetDataWithLength(length, charBuffer); + rc = prefBranch.SetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress()); + if (rc != XPCOM.NS_OK) error(rc); + } + localizedString.Release(); + prefBranch.Release(); + PromptServiceFactory factory = new PromptServiceFactory(); factory.AddRef(); - + rc = componentManager.QueryInterface(nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result); if (rc != XPCOM.NS_OK) error(rc); if (result[0] == 0) error(XPCOM.NS_NOINTERFACE); |