Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7bd29c94
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看板
提交
7bd29c94
编写于
11月 26, 2012
作者:
D
denis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7186952: Improve clipboard access
Reviewed-by: serb, ahgross
上级
f1fd07e6
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
18 addition
and
32 deletion
+18
-32
src/share/classes/java/awt/TextComponent.java
src/share/classes/java/awt/TextComponent.java
+7
-18
src/windows/native/sun/windows/awt_TextComponent.cpp
src/windows/native/sun/windows/awt_TextComponent.cpp
+10
-12
src/windows/native/sun/windows/awt_TextComponent.h
src/windows/native/sun/windows/awt_TextComponent.h
+1
-2
未找到文件。
src/share/classes/java/awt/TextComponent.java
浏览文件 @
7bd29c94
...
...
@@ -109,12 +109,6 @@ public class TextComponent extends Component implements Accessible {
// the background color of non-editable TextComponents.
boolean
backgroundSetByClientCode
=
false
;
/**
* True if this <code>TextComponent</code> has access
* to the System clipboard.
*/
transient
private
boolean
canAccessClipboard
;
transient
protected
TextListener
textListener
;
/*
...
...
@@ -139,7 +133,6 @@ public class TextComponent extends Component implements Accessible {
GraphicsEnvironment
.
checkHeadless
();
this
.
text
=
(
text
!=
null
)
?
text
:
""
;
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
TEXT_CURSOR
));
checkSystemClipboardAccess
();
}
private
void
enableInputMethodsIfNecessary
()
{
...
...
@@ -734,17 +727,14 @@ public class TextComponent extends Component implements Accessible {
/**
* Assigns a valid value to the canAccessClipboard instance variable.
*/
private
void
checkSystemClipboardAccess
()
{
canAccessClipboard
=
true
;
private
boolean
canAccessClipboard
()
{
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
if
(
sm
==
null
)
return
true
;
try
{
sm
.
checkSystemClipboardAccess
();
}
catch
(
SecurityException
e
)
{
canAccessClipboard
=
false
;
}
}
return
true
;
}
catch
(
SecurityException
e
)
{}
return
false
;
}
/*
...
...
@@ -827,7 +817,6 @@ public class TextComponent extends Component implements Accessible {
}
}
enableInputMethodsIfNecessary
();
checkSystemClipboardAccess
();
}
...
...
src/windows/native/sun/windows/awt_TextComponent.cpp
浏览文件 @
7bd29c94
...
...
@@ -53,14 +53,12 @@ struct EnableEditingStruct {
* AwtTextComponent fields
*/
/* java.awt.TextComponent fields */
jfieldID
AwtTextComponent
::
canAccessClipboardID
;
/************************************************************************
* AwtTextComponent methods
*/
jmethodID
AwtTextComponent
::
canAccessClipboardMID
;
AwtTextComponent
::
AwtTextComponent
()
{
m_synthetic
=
FALSE
;
m_lStartPos
=
-
1
;
...
...
@@ -367,8 +365,7 @@ AwtTextComponent::WmPaste()
}
jobject
target
=
GetTarget
(
env
);
jboolean
canAccessClipboard
=
env
->
GetBooleanField
(
target
,
AwtTextComponent
::
canAccessClipboardID
);
env
->
CallBooleanMethod
(
target
,
AwtTextComponent
::
canAccessClipboardMID
);
env
->
DeleteLocalRef
(
target
);
return
(
canAccessClipboard
)
?
mrDoDefault
:
mrConsume
;
}
...
...
@@ -854,12 +851,13 @@ Java_sun_awt_windows_WTextComponentPeer_initIDs(JNIEnv *env, jclass cls)
{
TRY
;
cls
=
env
->
FindClass
(
"java/awt/TextComponent"
);
if
(
cls
!=
NULL
)
{
AwtTextComponent
::
canAccessClipboardID
=
env
->
GetFieldID
(
cls
,
"canAccessClipboard"
,
"Z"
);
DASSERT
(
AwtTextComponent
::
canAccessClipboardID
!=
NULL
);
}
jclass
textComponentClassID
=
env
->
FindClass
(
"java/awt/TextComponent"
);
AwtTextComponent
::
canAccessClipboardMID
=
env
->
GetMethodID
(
textComponentClassID
,
"canAccessClipboard"
,
"()Z"
);
env
->
DeleteLocalRef
(
textComponentClassID
);
DASSERT
(
AwtTextComponent
::
canAccessClipboardMID
!=
NULL
);
CATCH_BAD_ALLOC
;
}
...
...
src/windows/native/sun/windows/awt_TextComponent.h
浏览文件 @
7bd29c94
...
...
@@ -42,8 +42,7 @@
class
AwtTextComponent
:
public
AwtComponent
{
public:
/* java.awt.TextComponent canAccessClipboard field ID */
static
jfieldID
canAccessClipboardID
;
static
jmethodID
canAccessClipboardMID
;
AwtTextComponent
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录