< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp
Print this page
*** 347,371 ****
AwtDialog::CheckInstallModalHook();
// show the Win32 file dialog
if (mode == java_awt_FileDialog_LOAD) {
! result = AwtFileDialog::GetOpenFileName(&ofn);
} else {
! result = AwtFileDialog::GetSaveFileName(&ofn);
}
// Fix for 4181310: FileDialog does not show up.
// If the dialog is not shown because of invalid file name
// replace the file name by empty string.
if (!result) {
dlgerr = ::CommDlgExtendedError();
if (dlgerr == FNERR_INVALIDFILENAME) {
_tcscpy_s(fileBuffer, bufferLimit, TEXT(""));
if (mode == java_awt_FileDialog_LOAD) {
! result = AwtFileDialog::GetOpenFileName(&ofn);
} else {
! result = AwtFileDialog::GetSaveFileName(&ofn);
}
}
}
AwtDialog::CheckUninstallModalHook();
--- 347,371 ----
AwtDialog::CheckInstallModalHook();
// show the Win32 file dialog
if (mode == java_awt_FileDialog_LOAD) {
! result = ::GetOpenFileName(&ofn);
} else {
! result = ::GetSaveFileName(&ofn);
}
// Fix for 4181310: FileDialog does not show up.
// If the dialog is not shown because of invalid file name
// replace the file name by empty string.
if (!result) {
dlgerr = ::CommDlgExtendedError();
if (dlgerr == FNERR_INVALIDFILENAME) {
_tcscpy_s(fileBuffer, bufferLimit, TEXT(""));
if (mode == java_awt_FileDialog_LOAD) {
! result = ::GetOpenFileName(&ofn);
} else {
! result = ::GetSaveFileName(&ofn);
}
}
}
AwtDialog::CheckUninstallModalHook();
*** 420,445 ****
delete[] currentDirectory;
if (ofn.lpstrFile)
delete[] ofn.lpstrFile;
}
- BOOL
- AwtFileDialog::GetOpenFileName(LPOPENFILENAME data) {
- return static_cast<BOOL>(reinterpret_cast<INT_PTR>(
- AwtToolkit::GetInstance().InvokeFunction((void*(*)(void*))
- ::GetOpenFileName, data)));
-
- }
-
- BOOL
- AwtFileDialog::GetSaveFileName(LPOPENFILENAME data) {
- return static_cast<BOOL>(reinterpret_cast<INT_PTR>(
- AwtToolkit::GetInstance().InvokeFunction((void *(*)(void *))
- ::GetSaveFileName, data)));
-
- }
-
BOOL AwtFileDialog::InheritsNativeMouseWheelBehavior() {return true;}
void AwtFileDialog::_DisposeOrHide(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
--- 420,429 ----
*** 583,595 ****
* Fix for 4906972.
* 'peer' reference has to be global as it's used further in another thread.
*/
jobject peerGlobal = env->NewGlobalRef(peer);
! AwtToolkit::GetInstance().InvokeFunction(AwtFileDialog::Show, peerGlobal);
!
env->DeleteGlobalRef(peerGlobal);
CATCH_BAD_ALLOC;
}
JNIEXPORT void JNICALL
--- 567,580 ----
* Fix for 4906972.
* 'peer' reference has to be global as it's used further in another thread.
*/
jobject peerGlobal = env->NewGlobalRef(peer);
! if (!AwtToolkit::GetInstance().PostMessage(WM_AWT_INVOKE_METHOD,
! (WPARAM)AwtFileDialog::Show, (LPARAM)peerGlobal)) {
env->DeleteGlobalRef(peerGlobal);
+ }
CATCH_BAD_ALLOC;
}
JNIEXPORT void JNICALL
< prev index next >