FILE COMPARISON
Produced: 2/18/2011 1:25:11 AM
   
Mode:  All Lines  
Left base folder: C:\Documents and Settings\krollins\My Documents\Admin\OpenSource\eRCP\eSWT\eSWT-1.2.orig  
Right base folder: C:\Documents and Settings\krollins\My Documents\Admin\OpenSource\eRCP\eSWT\eSWT-1.2.today  
   
File: org.eclipse.ercp.swt.core.win\common-native\impl\jni_MenuItem.c  
1 /******************************************************************************* = 1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 IBM Corporation and others.   2 * Copyright (c) 2000, 2005 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials   3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0   4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at   5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html   6 * http://www.eclipse.org/legal/epl-v10.html
7 *   7 *
8 * Contributors:   8 * Contributors:
9 *     IBM Corporation - initial API and implementation   9 *     IBM Corporation - initial API and implementation
10 *******************************************************************************/   10 *******************************************************************************/
11     11  
    <> 12 /*******************************************************************************
      13 * Additions/modifications to this source file by Oracle America, Inc. 2011
      14 *******************************************************************************/
      15  
12 #include "UGL_ErrorImpl.h" = 16 #include "UGL_ErrorImpl.h"
13 #include "UGL_Error.h"   17 #include "UGL_Error.h"
14 #include "TypeConverter.h"   18 #include "TypeConverter.h"
15 #include "MenuItem.h"   19 #include "MenuItem.h"
16 #include <jni.h>   20 #include <jni.h>
17 #include "JNIHelpers.h"   21 #include "JNIHelpers.h"
18 #include "UGLTypes.h"   22 #include "UGLTypes.h"
19     23  
20 #ifdef __cplusplus   24 #ifdef __cplusplus
21 #define UNUSED(var)   25 #define UNUSED(var)
22 #else   26 #else
23 #define UNUSED(var) var   27 #define UNUSED(var) var
24 #endif   28 #endif
25     29  
26 #ifdef __cplusplus   30 #ifdef __cplusplus
27 extern "C" {   31 extern "C" {
28 #endif   32 #endif
29     33  
30     34  
31 /**   35 /**
32 * Enables or disables a menu item.   36 * Enables or disables a menu item.
33 */   37 */
34 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_AbstractMenuItem_1SetEnabled(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jboolean enabled)   38 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_AbstractMenuItem_1SetEnabled(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jboolean enabled)
35 {   39 {
36     UGL_ErrorStruct error;   40     UGL_ErrorStruct error;
37     UGL_Boolean nativeenabled;   41     UGL_Boolean nativeenabled;
38       42    
39     nativeenabled = convertToNativeBoolean(env, enabled);   43     nativeenabled = convertToNativeBoolean(env, enabled);
40     error.error_code = 0;   44     error.error_code = 0;
41       45    
42     #ifdef debug_print   46     #ifdef debug_print
43     APITRACE(env, "Entering - AbstractMenuItem_SetEnabled\n");   47     APITRACE(env, "Entering - AbstractMenuItem_SetEnabled\n");
44     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);   48     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);
45     APIARGTRACE(env, "\tnativeenabled=%d\n" , nativeenabled);   49     APIARGTRACE(env, "\tnativeenabled=%d\n" , nativeenabled);
46     #endif   50     #endif
47     51  
48     AbstractMenuItem_SetEnabled(menuItemHandle, nativeenabled, &error);   52     AbstractMenuItem_SetEnabled(menuItemHandle, nativeenabled, &error);
49     if (error.error_code == 0) {   53     if (error.error_code == 0) {
50         return;   54         return;
51     } else {   55     } else {
52         UGL_ErrorHandler(env, "AbstractMenuItem_SetEnabled", &error);   56         UGL_ErrorHandler(env, "AbstractMenuItem_SetEnabled", &error);
53     }   57     }
54 }   58 }
55     59  
56 /**   60 /**
57 * Creates a new cascade menu item, and places it at the given   61 * Creates a new cascade menu item, and places it at the given
58 * index of the menu.  If the index value is -1, the menu should   62 * index of the menu.  If the index value is -1, the menu should
59 * append the new item.   63 * append the new item.
60 */   64 */
61 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_CascadeMenuItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index)   65 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_CascadeMenuItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index)
62 {   66 {
63     UGL_ErrorStruct error;   67     UGL_ErrorStruct error;
64     UGL_Int returnValue;   68     UGL_Int returnValue;
65       69    
66     error.error_code = 0;   70     error.error_code = 0;
67       71    
68     #ifdef debug_print   72     #ifdef debug_print
69     APITRACE(env, "Entering - CascadeMenuItem_New\n");   73     APITRACE(env, "Entering - CascadeMenuItem_New\n");
70     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);   74     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);
71     APIARGTRACE(env, "\tindex=%d\n" , index);   75     APIARGTRACE(env, "\tindex=%d\n" , index);
72     #endif   76     #endif
73     77  
74     returnValue = CascadeMenuItem_New(menuHandle, index, &error);   78     returnValue = CascadeMenuItem_New(menuHandle, index, &error);
75     if (error.error_code == 0) {   79     if (error.error_code == 0) {
76         return returnValue;   80         return returnValue;
77     } else {   81     } else {
78         UGL_ErrorHandler(env, "CascadeMenuItem_New", &error);   82         UGL_ErrorHandler(env, "CascadeMenuItem_New", &error);
79         return 0;   83         return 0;
80     }   84     }
81 }   85 }
82     86  
83 /**   87 /**
84 * Sets the submenu of a cascade menu item.   88 * Sets the submenu of a cascade menu item.
85 */   89 */
86 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_CascadeMenuItem_1SetMenu(JNIEnv* env, jclass UNUSED(clazz), jint cascadeMenuItemHandle, jint dropDownMenuHandle)   90 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_CascadeMenuItem_1SetMenu(JNIEnv* env, jclass UNUSED(clazz), jint cascadeMenuItemHandle, jint dropDownMenuHandle)
87 {   91 {
88     UGL_ErrorStruct error;   92     UGL_ErrorStruct error;
89       93    
90     error.error_code = 0;   94     error.error_code = 0;
91       95    
92     #ifdef debug_print   96     #ifdef debug_print
93     APITRACE(env, "Entering - CascadeMenuItem_SetMenu\n");   97     APITRACE(env, "Entering - CascadeMenuItem_SetMenu\n");
94     APIARGTRACE(env, "\tcascadeMenuItemHandle=%d\n" , cascadeMenuItemHandle);   98     APIARGTRACE(env, "\tcascadeMenuItemHandle=%d\n" , cascadeMenuItemHandle);
95     APIARGTRACE(env, "\tdropDownMenuHandle=%d\n" , dropDownMenuHandle);   99     APIARGTRACE(env, "\tdropDownMenuHandle=%d\n" , dropDownMenuHandle);
96     #endif   100     #endif
97     101  
98     CascadeMenuItem_SetMenu(cascadeMenuItemHandle, dropDownMenuHandle, &error);   102     CascadeMenuItem_SetMenu(cascadeMenuItemHandle, dropDownMenuHandle, &error);
99     if (error.error_code == 0) {   103     if (error.error_code == 0) {
100         return;   104         return;
101     } else {   105     } else {
102         UGL_ErrorHandler(env, "CascadeMenuItem_SetMenu", &error);   106         UGL_ErrorHandler(env, "CascadeMenuItem_SetMenu", &error);
103     }   107     }
104 }   108 }
105     109  
106 /**   110 /**
107 * Sets the accelerator for a LabeledMenuItem.  The accelerator is a bitwise   111 * Sets the accelerator for a LabeledMenuItem.  The accelerator is a bitwise
108 * OR of MODIFIER_MASK constants and keycode values.  The MODIFIER_MASK constants   112 * OR of MODIFIER_MASK constants and keycode values.  The MODIFIER_MASK constants
109 * are placed in the upper 16 bits of the value.  The keycode is in the lower   113 * are placed in the upper 16 bits of the value.  The keycode is in the lower
110 * 16 bits.  Valid keycodes are either KEYCODE constants or 16-bit char values.   114 * 16 bits.  Valid keycodes are either KEYCODE constants or 16-bit char values.
111 */   115 */
112 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_LabeledMenuItem_1SetAccelerator(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jint accelerator)   116 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_LabeledMenuItem_1SetAccelerator(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jint accelerator)
113 {   117 {
114     UGL_ErrorStruct error;   118     UGL_ErrorStruct error;
115       119    
116     error.error_code = 0;   120     error.error_code = 0;
117       121    
118     #ifdef debug_print   122     #ifdef debug_print
119     APITRACE(env, "Entering - LabeledMenuItem_SetAccelerator\n");   123     APITRACE(env, "Entering - LabeledMenuItem_SetAccelerator\n");
120     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);   124     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);
121     APIARGTRACE(env, "\taccelerator=%d\n" , accelerator);   125     APIARGTRACE(env, "\taccelerator=%d\n" , accelerator);
122     #endif   126     #endif
123     127  
124     LabeledMenuItem_SetAccelerator(menuItemHandle, accelerator, &error);   128     LabeledMenuItem_SetAccelerator(menuItemHandle, accelerator, &error);
125     if (error.error_code == 0) {   129     if (error.error_code == 0) {
126         return;   130         return;
127     } else {   131     } else {
128         UGL_ErrorHandler(env, "LabeledMenuItem_SetAccelerator", &error);   132         UGL_ErrorHandler(env, "LabeledMenuItem_SetAccelerator", &error);
129     }   133     }
130 }   134 }
131     135  
132 /**   136 /**
133 * Sets the descriptive text and the accelerator text of a LabeledMenuItem.   137 * Sets the descriptive text and the accelerator text of a LabeledMenuItem.
134 * The descriptive text may contain mnemonic characters, which are preceded   138 * The descriptive text may contain mnemonic characters, which are preceded
135 * by the '&amp;' character.  In order to add a '&amp;' character to the text,   139 * by the '&amp;' character.  In order to add a '&amp;' character to the text,
136 * it should be escaped with another '&amp;' character.   140 * it should be escaped with another '&amp;' character.
137 * The accelerator text is displayed next to the descriptive text in the item,   141 * The accelerator text is displayed next to the descriptive text in the item,
138 * and usually describes the accelerator, if one is being used.  Note that the   142 * and usually describes the accelerator, if one is being used.  Note that the
139 * accelerator text does not actually set the accelerator.  That is done by   143 * accelerator text does not actually set the accelerator.  That is done by
140 * LabeledMenuItem_SetAccelerator.   144 * LabeledMenuItem_SetAccelerator.
141 */   145 */
142 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_LabeledMenuItem_1SetText(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jstring text, jstring accelText)   146 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_LabeledMenuItem_1SetText(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jstring text, jstring accelText)
143 {   147 {
144     const jchar* accelTextCharData;   148     const jchar* accelTextCharData;
145     jint accelTextLength;   149     jint accelTextLength;
146     UGL_Boolean accelTextShouldFree;   150     UGL_Boolean accelTextShouldFree;
147     UGL_ErrorStruct error;   151     UGL_ErrorStruct error;
148     const jchar* textCharData;   152     const jchar* textCharData;
149     jint textLength;   153     jint textLength;
150     UGL_Boolean textShouldFree;   154     UGL_Boolean textShouldFree;
151     UGL_String uglaccelText;   155     UGL_String uglaccelText;
152     UGL_String ugltext;   156     UGL_String ugltext;
153       157    
154     textCharData = GetStringChars(env, text);   158     textCharData = GetStringChars(env, text);
155     if (ExceptionCheck(env)) return ;   159     if (ExceptionCheck(env)) return ;
156     textLength = GetStringLength(env, text);   160     textLength = GetStringLength(env, text);
157     ugltext = convertToNativeString(textCharData, textLength, &textShouldFree);   161     ugltext = convertToNativeString(textCharData, textLength, &textShouldFree);
158     accelTextCharData = GetStringChars(env, accelText);   162     accelTextCharData = GetStringChars(env, accelText);
159     if (ExceptionCheck(env)) return ;   163     if (ExceptionCheck(env)) return ;
160     accelTextLength = GetStringLength(env, accelText);   164     accelTextLength = GetStringLength(env, accelText);
161     uglaccelText = convertToNativeString(accelTextCharData, accelTextLength, &accelTextShouldFree);   165     uglaccelText = convertToNativeString(accelTextCharData, accelTextLength, &accelTextShouldFree);
162     error.error_code = 0;   166     error.error_code = 0;
163       167    
164     #ifdef debug_print   168     #ifdef debug_print
165     APITRACE(env, "Entering - LabeledMenuItem_SetText\n");   169     APITRACE(env, "Entering - LabeledMenuItem_SetText\n");
166     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);   170     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);
167     APITRACE(env, "\ttextCharData=");   171     APITRACE(env, "\ttextCharData=");
168     {   172     {
169         int i;   173         int i;
170         for (i=0; i<textLength; i++) APIARGTRACE(env, "%c" , textCharData[i]);   174         for (i=0; i<textLength; i++) APIARGTRACE(env, "%c" , textCharData[i]);
171     }   175     }
172     APITRACE(env, "\n");   176     APITRACE(env, "\n");
173     APITRACE(env, "\taccelTextCharData=");   177     APITRACE(env, "\taccelTextCharData=");
174     {   178     {
175         int i;   179         int i;
176         for (i=0; i<accelTextLength; i++) APIARGTRACE(env, "%c" , accelTextCharData[i]);   180         for (i=0; i<accelTextLength; i++) APIARGTRACE(env, "%c" , accelTextCharData[i]);
177     }   181     }
178     APITRACE(env, "\n");   182     APITRACE(env, "\n");
179     #endif   183     #endif
180     184  
181     LabeledMenuItem_SetText(menuItemHandle, ugltext, uglaccelText, &error);   185     LabeledMenuItem_SetText(menuItemHandle, ugltext, uglaccelText, &error);
182     if (textShouldFree) freeNativeString(ugltext);   186     if (textShouldFree) freeNativeString(ugltext);
183     ReleaseStringChars(env, text, textCharData);   187     ReleaseStringChars(env, text, textCharData);
184     if (accelTextShouldFree) freeNativeString(uglaccelText);   188     if (accelTextShouldFree) freeNativeString(uglaccelText);
185     ReleaseStringChars(env, accelText, accelTextCharData);   189     ReleaseStringChars(env, accelText, accelTextCharData);
186     if (error.error_code == 0) {   190     if (error.error_code == 0) {
187         return;   191         return;
188     } else {   192     } else {
189         UGL_ErrorHandler(env, "LabeledMenuItem_SetText", &error);   193         UGL_ErrorHandler(env, "LabeledMenuItem_SetText", &error);
190     }   194     }
191 }   195 }
192     196  
193 /**   197 /**
194 * Creates a new push menu item.   198 * Creates a new push menu item.
195 */   199 */
196 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_PushMenuItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index)   200 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_PushMenuItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index)
197 {   201 {
198     UGL_ErrorStruct error;   202     UGL_ErrorStruct error;
199     UGL_Int returnValue;   203     UGL_Int returnValue;
200       204    
201     error.error_code = 0;   205     error.error_code = 0;
202       206    
203     #ifdef debug_print   207     #ifdef debug_print
204     APITRACE(env, "Entering - PushMenuItem_New\n");   208     APITRACE(env, "Entering - PushMenuItem_New\n");
205     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);   209     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);
206     APIARGTRACE(env, "\tindex=%d\n" , index);   210     APIARGTRACE(env, "\tindex=%d\n" , index);
207     #endif   211     #endif
208     212  
209     returnValue = PushMenuItem_New(menuHandle, index, &error);   213     returnValue = PushMenuItem_New(menuHandle, index, &error);
210     if (error.error_code == 0) {   214     if (error.error_code == 0) {
211         return returnValue;   215         return returnValue;
212     } else {   216     } else {
213         UGL_ErrorHandler(env, "PushMenuItem_New", &error);   217         UGL_ErrorHandler(env, "PushMenuItem_New", &error);
214         return 0;   218         return 0;
215     }   219     }
216 }   220 }
217     221  
218 /**   222 /**
219 * Creates a new separator menu item.   223 * Creates a new separator menu item.
220 */   224 */
221 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_SeparatorItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index)   225 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_SeparatorItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index)
222 {   226 {
223     UGL_ErrorStruct error;   227     UGL_ErrorStruct error;
224     UGL_Int returnValue;   228     UGL_Int returnValue;
225       229    
226     error.error_code = 0;   230     error.error_code = 0;
227       231    
228     #ifdef debug_print   232     #ifdef debug_print
229     APITRACE(env, "Entering - SeparatorItem_New\n");   233     APITRACE(env, "Entering - SeparatorItem_New\n");
230     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);   234     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);
231     APIARGTRACE(env, "\tindex=%d\n" , index);   235     APIARGTRACE(env, "\tindex=%d\n" , index);
232     #endif   236     #endif
233     237  
234     returnValue = SeparatorItem_New(menuHandle, index, &error);   238     returnValue = SeparatorItem_New(menuHandle, index, &error);
235     if (error.error_code == 0) {   239     if (error.error_code == 0) {
236         return returnValue;   240         return returnValue;
237     } else {   241     } else {
238         UGL_ErrorHandler(env, "SeparatorItem_New", &error);   242         UGL_ErrorHandler(env, "SeparatorItem_New", &error);
239         return 0;   243         return 0;
240     }   244     }
241 }   245 }
242     246  
243 /**   247 /**
244 * Creates a new menu item which has a selection state, similar to a checkbox.   248 * Creates a new menu item which has a selection state, similar to a checkbox.
245 */   249 */
246 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_StateMenuItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index, jint style)   250 JNIEXPORT jint JNICALL Java_com_ibm_ugl_eswt_OS_StateMenuItem_1New(JNIEnv* env, jclass UNUSED(clazz), jint menuHandle, jint index, jint style)
247 {   251 {
248     UGL_ErrorStruct error;   252     UGL_ErrorStruct error;
249     UGL_Int returnValue;   253     UGL_Int returnValue;
250       254    
251     error.error_code = 0;   255     error.error_code = 0;
252       256    
253     #ifdef debug_print   257     #ifdef debug_print
254     APITRACE(env, "Entering - StateMenuItem_New\n");   258     APITRACE(env, "Entering - StateMenuItem_New\n");
255     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);   259     APIARGTRACE(env, "\tmenuHandle=%d\n" , menuHandle);
256     APIARGTRACE(env, "\tindex=%d\n" , index);   260     APIARGTRACE(env, "\tindex=%d\n" , index);
257     APIARGTRACE(env, "\tstyle=%d\n" , style);   261     APIARGTRACE(env, "\tstyle=%d\n" , style);
258     #endif   262     #endif
259     263  
260     returnValue = StateMenuItem_New(menuHandle, index, style, &error);   264     returnValue = StateMenuItem_New(menuHandle, index, style, &error);
261     if (error.error_code == 0) {   265     if (error.error_code == 0) {
262         return returnValue;   266         return returnValue;
263     } else {   267     } else {
264         UGL_ErrorHandler(env, "StateMenuItem_New", &error);   268         UGL_ErrorHandler(env, "StateMenuItem_New", &error);
265         return 0;   269         return 0;
266     }   270     }
267 }   271 }
268     272  
269 /**   273 /**
270 * Sets the selection state of a state menu item.   274 * Sets the selection state of a state menu item.
271 */   275 */
272 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_StateMenuItem_1SetSelection(JNIEnv* env, jclass UNUSED(clazz), jint statefulMenuItemHandle, jboolean selected)   276 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_StateMenuItem_1SetSelection(JNIEnv* env, jclass UNUSED(clazz), jint statefulMenuItemHandle, jboolean selected)
273 {   277 {
274     UGL_ErrorStruct error;   278     UGL_ErrorStruct error;
275     UGL_Boolean nativeselected;   279     UGL_Boolean nativeselected;
276       280    
277     nativeselected = convertToNativeBoolean(env, selected);   281     nativeselected = convertToNativeBoolean(env, selected);
278     error.error_code = 0;   282     error.error_code = 0;
279       283    
280     #ifdef debug_print   284     #ifdef debug_print
281     APITRACE(env, "Entering - StateMenuItem_SetSelection\n");   285     APITRACE(env, "Entering - StateMenuItem_SetSelection\n");
282     APIARGTRACE(env, "\tstatefulMenuItemHandle=%d\n" , statefulMenuItemHandle);   286     APIARGTRACE(env, "\tstatefulMenuItemHandle=%d\n" , statefulMenuItemHandle);
283     APIARGTRACE(env, "\tnativeselected=%d\n" , nativeselected);   287     APIARGTRACE(env, "\tnativeselected=%d\n" , nativeselected);
284     #endif   288     #endif
285     289  
286     StateMenuItem_SetSelection(statefulMenuItemHandle, nativeselected, &error);   290     StateMenuItem_SetSelection(statefulMenuItemHandle, nativeselected, &error);
287     if (error.error_code == 0) {   291     if (error.error_code == 0) {
288         return;   292         return;
289     } else {   293     } else {
290         UGL_ErrorHandler(env, "StateMenuItem_SetSelection", &error);   294         UGL_ErrorHandler(env, "StateMenuItem_SetSelection", &error);
291     }   295     }
292 }   296 }
293     297  
    <> 298 /**
      299 * Sets the disableAutoSelection state of a state menu item.
      300 */
      301 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_StateMenuItem_1DisableAutoSelection(JNIEnv* env, jclass UNUSED(clazz), jint statefulMenuItemHandle, jboolean disableAutoSelection)
      302 {
      303     UGL_Boolean nativeDisableAutoSelection;
      304    
      305     nativeDisableAutoSelection = convertToNativeBoolean(env, disableAutoSelection);
      306  
      307     StateMenuItem_DisableAutoSelection(statefulMenuItemHandle, nativeDisableAutoSelection);
      308 }
294   = 309  
295     310  
296 /**   311 /**
297 * Sets the image which is displayed on a LabeledMenuItem.  If the   312 * Sets the image which is displayed on a LabeledMenuItem.  If the
298 * imageHandle is zero, remove the current image.   313 * imageHandle is zero, remove the current image.
299 */   314 */
300 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_LabeledMenuItem_1SetImage(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jint imageHandle)   315 JNIEXPORT void JNICALL Java_com_ibm_ugl_eswt_OS_LabeledMenuItem_1SetImage(JNIEnv* env, jclass UNUSED(clazz), jint menuItemHandle, jint imageHandle)
301 {   316 {
302     UGL_ErrorStruct error;   317     UGL_ErrorStruct error;
303       318    
304     error.error_code = 0;   319     error.error_code = 0;
305       320    
306     #ifdef debug_print   321     #ifdef debug_print
307     APITRACE(env, "Entering - LabeledMenuItem_SetImage\n");   322     APITRACE(env, "Entering - LabeledMenuItem_SetImage\n");
308     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);   323     APIARGTRACE(env, "\tmenuItemHandle=%d\n" , menuItemHandle);
309     APIARGTRACE(env, "\timageHandle=%d\n" , imageHandle);   324     APIARGTRACE(env, "\timageHandle=%d\n" , imageHandle);
310     #endif   325     #endif
311     326  
312     LabeledMenuItem_SetImage(menuItemHandle, imageHandle, &error);   327     LabeledMenuItem_SetImage(menuItemHandle, imageHandle, &error);
313     if (error.error_code == 0) {   328     if (error.error_code == 0) {
314         return;   329         return;
315     } else {   330     } else {
316         UGL_ErrorHandler(env, "LabeledMenuItem_SetImage", &error);   331         UGL_ErrorHandler(env, "LabeledMenuItem_SetImage", &error);
317     }   332     }
318 }   333 }
319     334  
320     335  
321     336  
322 #ifdef __cplusplus   337 #ifdef __cplusplus
323 }   338 }
324 #endif   339 #endif
325     340