Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
bafc6e8b
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看板
提交
bafc6e8b
编写于
8月 27, 2008
作者:
R
rupashka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6351074: JFileChooser removes leading space in filename
Summary: Removed trimming of leading spaces in filename Reviewed-by: alexp
上级
363ab66c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
82 addition
and
82 deletion
+82
-82
src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
...re/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
+82
-82
未找到文件。
src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
浏览文件 @
bafc6e8b
...
...
@@ -36,6 +36,7 @@ import java.awt.datatransfer.*;
import
java.beans.*
;
import
java.io.*
;
import
java.util.*
;
import
java.util.List
;
import
java.util.regex.*
;
import
sun.awt.shell.ShellFolder
;
import
sun.swing.*
;
...
...
@@ -829,11 +830,17 @@ public class BasicFileChooserUI extends FileChooserUI {
File
dir
=
chooser
.
getCurrentDirectory
();
if
(
filename
!=
null
)
{
// Remove whitespace from beginning and end of filename
filename
=
filename
.
trim
();
// Remove whitespaces from end of filename
int
i
=
filename
.
length
()
-
1
;
while
(
i
>=
0
&&
filename
.
charAt
(
i
)
<=
' '
)
{
i
--;
}
filename
=
filename
.
substring
(
0
,
i
+
1
);
}
if
(
filename
==
null
||
filename
.
equals
(
""
)
)
{
if
(
filename
==
null
||
filename
.
length
()
==
0
)
{
// no file selected, multiple selection off, therefore cancel the approve action
resetGlobFilter
();
return
;
...
...
@@ -842,7 +849,6 @@ public class BasicFileChooserUI extends FileChooserUI {
File
selectedFile
=
null
;
File
[]
selectedFiles
=
null
;
if
(
filename
!=
null
&&
!
filename
.
equals
(
""
))
{
// Unix: Resolve '~' to user's home directory
if
(
File
.
separatorChar
==
'/'
)
{
if
(
filename
.
startsWith
(
"~/"
))
{
...
...
@@ -852,25 +858,18 @@ public class BasicFileChooserUI extends FileChooserUI {
}
}
if
(
chooser
.
isMultiSelectionEnabled
()
&&
filename
.
startsWith
(
"\""
))
{
ArrayList
<
File
>
fList
=
new
ArrayList
<
File
>();
if
(
chooser
.
isMultiSelectionEnabled
()
&&
filename
.
length
()
>
1
&&
filename
.
charAt
(
0
)
==
'"'
&&
filename
.
charAt
(
filename
.
length
()
-
1
)
==
'"'
)
{
List
<
File
>
fList
=
new
ArrayList
<
File
>();
String
[]
files
=
filename
.
substring
(
1
,
filename
.
length
()
-
1
).
split
(
"\" \""
);
// Optimize searching files by names in "children" array
Arrays
.
sort
(
files
);
filename
=
filename
.
substring
(
1
);
if
(
filename
.
endsWith
(
"\""
))
{
filename
=
filename
.
substring
(
0
,
filename
.
length
()-
1
);
}
File
[]
children
=
null
;
int
childIndex
=
0
;
do
{
String
str
;
int
i
=
filename
.
indexOf
(
"\" \""
);
if
(
i
>
0
)
{
str
=
filename
.
substring
(
0
,
i
);
filename
=
filename
.
substring
(
i
+
3
);
}
else
{
str
=
filename
;
filename
=
""
;
}
for
(
String
str
:
files
)
{
File
file
=
fs
.
createFileObject
(
str
);
if
(!
file
.
isAbsolute
())
{
if
(
children
==
null
)
{
...
...
@@ -887,14 +886,15 @@ public class BasicFileChooserUI extends FileChooserUI {
}
}
fList
.
add
(
file
);
}
while
(
filename
.
length
()
>
0
);
if
(
fList
.
size
()
>
0
)
{
}
if
(!
fList
.
isEmpty
())
{
selectedFiles
=
fList
.
toArray
(
new
File
[
fList
.
size
()]);
}
resetGlobFilter
();
}
else
{
selectedFile
=
fs
.
createFileObject
(
filename
);
if
(!
selectedFile
.
isAbsolute
())
{
if
(!
selectedFile
.
isAbsolute
())
{
selectedFile
=
fs
.
getChild
(
dir
,
filename
);
}
// check for wildcard pattern
...
...
@@ -935,7 +935,7 @@ public class BasicFileChooserUI extends FileChooserUI {
selectedFile
=
null
;
}
}
}
if
(
selectedFiles
!=
null
||
selectedFile
!=
null
)
{
if
(
selectedFiles
!=
null
||
chooser
.
isMultiSelectionEnabled
())
{
if
(
selectedFiles
==
null
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录