Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1483590c
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1483590c
编写于
11月 08, 2010
作者:
A
anthony
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6960655: GTKFileDialogPeer shouldn't be a singletone
Reviewed-by: art, dcherepanov
上级
9534a6c0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
39 deletion
+49
-39
make/sun/xawt/mapfile-vers
make/sun/xawt/mapfile-vers
+1
-0
src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
+8
-0
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+32
-39
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
+8
-0
未找到文件。
make/sun/xawt/mapfile-vers
浏览文件 @
1483590c
...
...
@@ -429,6 +429,7 @@ SUNWprivate_1.1 {
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue;
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName;
Java_sun_awt_X11_GtkFileDialogPeer_initIDs;
Java_sun_awt_X11_GtkFileDialogPeer_run;
Java_sun_awt_X11_GtkFileDialogPeer_quit;
...
...
src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
浏览文件 @
1483590c
...
...
@@ -42,11 +42,19 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
private
FileDialog
fd
;
// A pointer to the native GTK FileChooser widget
private
volatile
long
widget
=
0L
;
public
GtkFileDialogPeer
(
FileDialog
fd
)
{
super
((
Dialog
)
fd
);
this
.
fd
=
fd
;
}
private
static
native
void
initIDs
();
static
{
initIDs
();
}
private
native
void
run
(
String
title
,
int
mode
,
String
dir
,
String
file
,
FilenameFilter
filter
,
boolean
isMultipleMode
);
...
...
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
浏览文件 @
1483590c
...
...
@@ -4,13 +4,29 @@
#include <string.h>
#include "gtk2_interface.h"
#include "sun_awt_X11_GtkFileDialogPeer.h"
#include "debug_assert.h"
static
JavaVM
*
jvm
;
static
GtkWidget
*
dialog
=
NULL
;
/* To cache some method IDs */
static
jmethodID
filenameFilterCallbackMethodID
=
NULL
;
static
jmethodID
setFileInternalMethodID
=
NULL
;
static
jfieldID
widgetFieldID
=
NULL
;
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_GtkFileDialogPeer_initIDs
(
JNIEnv
*
env
,
jclass
cx
)
{
filenameFilterCallbackMethodID
=
(
*
env
)
->
GetMethodID
(
env
,
cx
,
"filenameFilterCallback"
,
"(Ljava/lang/String;)Z"
);
DASSERT
(
filenameFilterCallbackMethodID
!=
NULL
);
setFileInternalMethodID
=
(
*
env
)
->
GetMethodID
(
env
,
cx
,
"setFileInternal"
,
"(Ljava/lang/String;[Ljava/lang/String;)V"
);
DASSERT
(
setFileInternalMethodID
!=
NULL
);
widgetFieldID
=
(
*
env
)
->
GetFieldID
(
env
,
cx
,
"widget"
,
"J"
);
DASSERT
(
widgetFieldID
!=
NULL
);
}
static
gboolean
filenameFilterCallback
(
const
GtkFileFilterInfo
*
filter_info
,
gpointer
obj
)
{
...
...
@@ -20,30 +36,17 @@ static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gp
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
if
(
filenameFilterCallbackMethodID
==
NULL
)
{
cx
=
(
*
env
)
->
GetObjectClass
(
env
,
(
jobject
)
obj
);
if
(
cx
==
NULL
)
{
JNU_ThrowInternalError
(
env
,
"Could not get file filter class"
);
return
0
;
}
filenameFilterCallbackMethodID
=
(
*
env
)
->
GetMethodID
(
env
,
cx
,
"filenameFilterCallback"
,
"(Ljava/lang/String;)Z"
);
if
(
filenameFilterCallbackMethodID
==
NULL
)
{
JNU_ThrowInternalError
(
env
,
"Could not get filenameFilterCallback method id"
);
return
0
;
}
}
filename
=
(
*
env
)
->
NewStringUTF
(
env
,
filter_info
->
filename
);
return
(
*
env
)
->
CallBooleanMethod
(
env
,
obj
,
filenameFilterCallbackMethodID
,
filename
);
}
static
void
quit
(
gboolean
isSignalHandler
)
static
void
quit
(
JNIEnv
*
env
,
jobject
jpeer
,
gboolean
isSignalHandler
)
{
GtkWidget
*
dialog
=
(
GtkWidget
*
)
jlong_to_ptr
(
(
*
env
)
->
GetLongField
(
env
,
jpeer
,
widgetFieldID
));
if
(
dialog
!=
NULL
)
{
// Callbacks from GTK signals are made within the GTK lock
...
...
@@ -57,7 +60,8 @@ static void quit(gboolean isSignalHandler)
fp_gtk_widget_destroy
(
dialog
);
fp_gtk_main_quit
();
dialog
=
NULL
;
(
*
env
)
->
SetLongField
(
env
,
jpeer
,
widgetFieldID
,
0
);
if
(
!
isSignalHandler
)
{
fp_gdk_threads_leave
();
...
...
@@ -73,7 +77,7 @@ static void quit(gboolean isSignalHandler)
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_GtkFileDialogPeer_quit
(
JNIEnv
*
env
,
jobject
jpeer
)
{
quit
(
FALSE
);
quit
(
env
,
jpeer
,
FALSE
);
}
/**
...
...
@@ -132,24 +136,8 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
if
(
responseId
==
GTK_RESPONSE_ACCEPT
)
{
current_folder
=
fp_gtk_file_chooser_get_current_folder
(
GTK_FILE_CHOOSER
(
dialog
));
filenames
=
fp_gtk_file_chooser_get_filenames
(
GTK_FILE_CHOOSER
(
dialog
));
}
if
(
setFileInternalMethodID
==
NULL
)
{
cx
=
(
*
env
)
->
GetObjectClass
(
env
,
(
jobject
)
obj
);
if
(
cx
==
NULL
)
{
JNU_ThrowInternalError
(
env
,
"Could not get GTK peer class"
);
return
;
}
setFileInternalMethodID
=
(
*
env
)
->
GetMethodID
(
env
,
cx
,
"setFileInternal"
,
"(Ljava/lang/String;[Ljava/lang/String;)V"
);
if
(
setFileInternalMethodID
==
NULL
)
{
JNU_ThrowInternalError
(
env
,
"Could not get setFileInternalMethodID method id"
);
return
;
}
GTK_FILE_CHOOSER
(
aDialog
));
filenames
=
fp_gtk_file_chooser_get_filenames
(
GTK_FILE_CHOOSER
(
aDialog
));
}
jcurrent_folder
=
(
*
env
)
->
NewStringUTF
(
env
,
current_folder
);
...
...
@@ -159,7 +147,7 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
jfilenames
);
fp_g_free
(
current_folder
);
quit
(
TRUE
);
quit
(
env
,
(
jobject
)
obj
,
TRUE
);
}
/*
...
...
@@ -172,6 +160,7 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
jstring
jtitle
,
jint
mode
,
jstring
jdir
,
jstring
jfile
,
jobject
jfilter
,
jboolean
multiple
)
{
GtkWidget
*
dialog
=
NULL
;
GtkFileFilter
*
filter
;
if
(
jvm
==
NULL
)
{
...
...
@@ -233,8 +222,12 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
fp_g_signal_connect
(
G_OBJECT
(
dialog
),
"response"
,
G_CALLBACK
(
handle_response
),
jpeer
);
(
*
env
)
->
SetLongField
(
env
,
jpeer
,
widgetFieldID
,
ptr_to_jlong
(
dialog
));
fp_gtk_widget_show
(
dialog
);
fp_gtk_main
();
fp_gdk_threads_leave
();
}
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
浏览文件 @
1483590c
...
...
@@ -9,6 +9,14 @@ extern "C"
{
#endif
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_GtkFileDialogPeer_initIDs
(
JNIEnv
*
,
jclass
);
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: run
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录