fileNames= getPaths(dialog); if (fileNames.length > 0) result= fileNames[0];
result= interpretOsAnswer(dialog);
public String open () {	int dialog= 0;	String result= null;		int titleHandle= 0;	try {		int parentWindowHandle= 0;		if (parent != null)			parentWindowHandle= parent.shellHandle;				titleHandle= OS.CFStringCreateWithCharacters(title);		int status= 0;		int flags= 0;		int[] dialogHandle= new int[1];				if ((style & SWT.SAVE) != 0) {			status= OS.NavCreatePutFileDialog(flags, titleHandle, parentWindowHandle, dialogHandle,							MacUtil.OSType("TEXT"), MacUtil.OSType("KAHL"));		} else /* if ((style & SWT.OPEN) != 0) */ {			if ((style & SWT.MULTI) != 0)				flags |= OS.kNavAllowMultipleFiles;			status= OS.NavCreateGetFileDialog(flags, titleHandle, parentWindowHandle, dialogHandle);		}				if (status == 0) {			dialog= dialogHandle[0];		} else {			//System.out.println("FileDialog.open: status " + status);		}				if (dialog != 0) {			//System.out.println("FileDialog.open: got dialog");					if ((style & SWT.SAVE) != 0) {				int fileNameHandle= 0;				try {					fileNameHandle= OS.CFStringCreateWithCharacters(fileNames[0]);					OS.NavDialogSetSaveFileName(dialog, fileNameHandle);				} finally {					if (fileNameHandle != 0)						OS.CFRelease(fileNameHandle);				}			}					//System.out.println("FileDialog.open: vor run");			OS.NavDialogRun(dialog);			//System.out.println("FileDialog.open: nach run");					int action= OS.NavDialogGetUserAction(dialog);			switch (action) {			case OS.kNavUserActionCancel:				break;							case OS.kNavUserActionOpen:			case OS.kNavUserActionChoose:							fileNames= getPaths(dialog);				if (fileNames.length > 0)					result= fileNames[0];				break;							case OS.kNavUserActionSaveAs:				result= MacUtil.getStringAndRelease(OS.NavDialogGetSaveFileName(dialog));				break;			}		} else {			//System.out.println("FileDialog.open: dialog == null");		}	} finally {		if (titleHandle != 0)			OS.CFRelease(titleHandle);		if (dialog != 0)			OS.NavDialogDispose(dialog);	}		return result;}