if (OS.IsAIX) { OS.XtRealizeWidget (parentHandle); }
public String open () {	/* Get the parent */	boolean destroyContext;	Display appContext = Display.getCurrent ();	if (destroyContext = (appContext == null)) appContext = new Display ();	int display = appContext.xDisplay;	int parentHandle = appContext.shellHandle;	if ((parent != null) && (parent.getDisplay () == appContext))		parentHandle = parent.shellHandle;	/* Compute the dialog title */		/*	* Feature in Motif.  It is not possible to set a shell	* title to an empty string.  The fix is to set the title	* to be a single space.	*/	String string = title;	if (string.length () == 0) string = " ";	/* Use the character encoding for the default locale */	byte [] buffer1 = Converter.wcsToMbcs (null, string, true);	int xmStringPtr1 = OS.XmStringParseText (		buffer1,		0,		OS.XmFONTLIST_DEFAULT_TAG, 		OS.XmCHARSET_TEXT, 		null,		0,		0);	/* Compute the filter */	String mask = FILTER;	if (filterExtensions == null) filterExtensions = new String [0];	if (filterNames == null) filterNames = new String [0];	if (filterExtensions.length != 0) {		/* Motif does not support multiple filters, so ignore them		 * if there are more than one, or if there is a ; separator.		 */		if (filterExtensions.length == 1) {			String filter = filterExtensions [0];			if (filter.indexOf (';', 0) == -1) mask = filter;		}	}	/* Use the character encoding for the default locale */	byte [] buffer2 = Converter.wcsToMbcs (null, mask, true);	int xmStringPtr2 = OS.XmStringParseText (		buffer2,		0,		OS.XmFONTLIST_DEFAULT_TAG, 		OS.XmCHARSET_TEXT, 		null,		0,		0);	/* Compute the filter path */	if (filterPath == null) filterPath = "";	/* Use the character encoding for the default locale */	byte [] buffer3 = Converter.wcsToMbcs (null, filterPath, true);	int xmStringPtr3 = OS.XmStringParseText (		buffer3,		0,		OS.XmFONTLIST_DEFAULT_TAG, 		OS.XmCHARSET_TEXT, 		null,		0,		0);	/* Create the dialog */	int [] argList1 = {		OS.XmNresizePolicy, OS.XmRESIZE_NONE,		OS.XmNdialogStyle, OS.XmDIALOG_PRIMARY_APPLICATION_MODAL,		OS.XmNwidth, OS.XDisplayWidth (display, OS.XDefaultScreen (display)) * 4 / 9,		OS.XmNpathMode, OS.XmPATH_MODE_FULL,		OS.XmNdialogTitle, xmStringPtr1,		OS.XmNpattern, xmStringPtr2,		OS.XmNdirectory, xmStringPtr3,	};	/*	* Feature in Linux.  For some reason, the XmCreateFileSelectionDialog()	* will not accept NULL for the widget name.  This works fine on the other	* Motif platforms and in the other XmCreate calls on Linux.  The fix is	* to pass in a NULL terminated string, not a NULL pointer.	*/	byte [] name = new byte [] {0};	dialog = OS.XmCreateFileSelectionDialog (parentHandle, name, argList1, argList1.length / 2);	int child = OS.XmFileSelectionBoxGetChild (dialog, OS.XmDIALOG_HELP_BUTTON);	if (child != 0) OS.XtUnmanageChild (child);	OS.XmStringFree (xmStringPtr1);	OS.XmStringFree (xmStringPtr2);	OS.XmStringFree (xmStringPtr3);	/* Hook the callbacks. */	Callback cancelCallback = new Callback (this, "cancelPressed", 3);	int cancelAddress = cancelCallback.getAddress ();	OS.XtAddCallback (dialog, OS.XmNcancelCallback, cancelAddress, 0);	Callback okCallback = new Callback (this, "okPressed", 3);	int okAddress = okCallback.getAddress ();	OS.XtAddCallback (dialog, OS.XmNokCallback, okAddress, 0);	OS.XtManageChild (dialog);	// fix for bug 17507	if (OS.IsAIX) {	    OS.XtRealizeWidget (parentHandle);	}		//BOGUS - should be a pure OS message loop (no SWT AppContext)	while (OS.XtIsRealized (dialog) && OS.XtIsManaged (dialog))		if (!appContext.readAndDispatch ()) appContext.sleep ();	/* Destroy the dialog and update the display. */	if (OS.XtIsRealized (dialog)) OS.XtDestroyWidget (dialog);	if (destroyContext) appContext.dispose ();	okCallback.dispose ();	cancelCallback.dispose ();	if (cancel) return null;	return fullPath;}