Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
幽默龙
luyten
提交
ce92da4e
L
luyten
项目概览
幽默龙
/
luyten
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
luyten
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ce92da4e
编写于
5月 16, 2017
作者:
D
deathmarine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#79 Add checkbox to FindAll Dialog to search for classnames only
上级
56eb4b89
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
52 addition
and
40 deletion
+52
-40
src/us/deathmarine/luyten/FindAllBox.java
src/us/deathmarine/luyten/FindAllBox.java
+52
-40
未找到文件。
src/us/deathmarine/luyten/FindAllBox.java
浏览文件 @
ce92da4e
...
...
@@ -43,8 +43,10 @@ public class FindAllBox extends JDialog {
private
JCheckBox
mcase
;
private
JCheckBox
regex
;
private
JCheckBox
wholew
;
private
JCheckBox
classname
;
private
JList
<
String
>
list
;
private
JProgressBar
progressBar
;
boolean
locked
;
private
JLabel
statusLabel
=
new
JLabel
(
""
);
...
...
@@ -66,6 +68,7 @@ public class FindAllBox extends JDialog {
mcase
=
new
JCheckBox
(
"Match Case"
);
regex
=
new
JCheckBox
(
"Regex"
);
wholew
=
new
JCheckBox
(
"Whole Words"
);
classname
=
new
JCheckBox
(
"Classnames"
);
this
.
getRootPane
().
setDefaultButton
(
findButton
);
...
...
@@ -133,7 +136,8 @@ public class FindAllBox extends JDialog {
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
)
.
addComponent
(
mcase
))
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
).
addComponent
(
wholew
))
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
).
addComponent
(
regex
)))
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
).
addComponent
(
regex
))
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
).
addComponent
(
classname
)))
.
addGroup
(
layout
.
createSequentialGroup
()
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
).
addComponent
(
listScroller
)
.
addComponent
(
progressBar
))))
...
...
@@ -146,7 +150,7 @@ public class FindAllBox extends JDialog {
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
BASELINE
).
addComponent
(
label
).
addComponent
(
textField
)
.
addComponent
(
findButton
))
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
BASELINE
).
addComponent
(
mcase
).
addComponent
(
wholew
)
.
addComponent
(
regex
))
.
addComponent
(
regex
)
.
addComponent
(
classname
)
)
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
LEADING
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addGroup
(
layout
.
createParallelGroup
(
Alignment
.
BASELINE
).
addComponent
(
listScroller
))))
...
...
@@ -171,6 +175,7 @@ public class FindAllBox extends JDialog {
tmp_thread
.
interrupt
();
setStatus
(
"Stopped."
);
findButton
.
setText
(
"Find"
);
locked
=
false
;
}
else
{
findButton
.
setText
(
"Stop"
);
classesList
.
clear
();
...
...
@@ -188,59 +193,66 @@ public class FindAllBox extends JDialog {
JarEntry
entry
=
ent
.
nextElement
();
String
name
=
entry
.
getName
();
setStatus
(
name
);
System
.
out
.
println
(
entry
.
getName
());
if
(
filter
&&
name
.
contains
(
"$"
))
continue
;
if
(
entry
.
getName
().
endsWith
(
".class"
))
{
synchronized
(
settings
)
{
String
internalName
=
StringUtilities
.
removeRight
(
entry
.
getName
(),
".class"
);
TypeReference
type
=
Model
.
metadataSystem
.
lookupType
(
internalName
);
TypeDefinition
resolvedType
=
null
;
if
(
type
==
null
||
((
resolvedType
=
type
.
resolve
())
==
null
))
{
throw
new
Exception
(
"Unable to resolve type."
);
if
(
locked
||
classname
.
isSelected
()){
locked
=
true
;
if
(
search
(
entry
.
getName
()))
addClassName
(
entry
.
getName
());
}
else
{
if
(
entry
.
getName
().
endsWith
(
".class"
))
{
synchronized
(
settings
)
{
String
internalName
=
StringUtilities
.
removeRight
(
entry
.
getName
(),
".class"
);
TypeReference
type
=
Model
.
metadataSystem
.
lookupType
(
internalName
);
TypeDefinition
resolvedType
=
null
;
if
(
type
==
null
||
((
resolvedType
=
type
.
resolve
())
==
null
))
{
throw
new
Exception
(
"Unable to resolve type."
);
}
StringWriter
stringwriter
=
new
StringWriter
();
DecompilationOptions
decompilationOptions
;
decompilationOptions
=
new
DecompilationOptions
();
decompilationOptions
.
setSettings
(
settings
);
decompilationOptions
.
setFullDecompilation
(
true
);
PlainTextOutput
plainTextOutput
=
new
PlainTextOutput
(
stringwriter
);
plainTextOutput
.
setUnicodeOutputEnabled
(
decompilationOptions
.
getSettings
().
isUnicodeOutputEnabled
());
settings
.
getLanguage
().
decompileType
(
resolvedType
,
plainTextOutput
,
decompilationOptions
);
if
(
search
(
stringwriter
.
toString
()))
addClassName
(
entry
.
getName
());
}
StringWriter
stringwriter
=
new
StringWriter
();
DecompilationOptions
decompilationOptions
;
decompilationOptions
=
new
DecompilationOptions
();
decompilationOptions
.
setSettings
(
settings
);
decompilationOptions
.
setFullDecompilation
(
true
);
PlainTextOutput
plainTextOutput
=
new
PlainTextOutput
(
stringwriter
);
plainTextOutput
.
setUnicodeOutputEnabled
(
decompilationOptions
.
getSettings
().
isUnicodeOutputEnabled
());
settings
.
getLanguage
().
decompileType
(
resolvedType
,
plainTextOutput
,
decompilationOptions
);
if
(
search
(
stringwriter
.
toString
()))
addClassName
(
entry
.
getName
());
}
}
else
{
StringBuilder
sb
=
new
StringBuilder
();
long
nonprintableCharactersCount
=
0
;
try
(
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
jfile
.
getInputStream
(
entry
));
BufferedReader
reader
=
new
BufferedReader
(
inputStreamReader
);)
{
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
).
append
(
"\n"
);
for
(
byte
nextByte
:
line
.
getBytes
())
{
if
(
nextByte
<=
0
)
{
nonprintableCharactersCount
++;
}
else
{
StringBuilder
sb
=
new
StringBuilder
();
long
nonprintableCharactersCount
=
0
;
try
(
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
jfile
.
getInputStream
(
entry
));
BufferedReader
reader
=
new
BufferedReader
(
inputStreamReader
);)
{
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
).
append
(
"\n"
);
for
(
byte
nextByte
:
line
.
getBytes
())
{
if
(
nextByte
<=
0
)
{
nonprintableCharactersCount
++;
}
}
}
}
}
if
(
nonprintableCharactersCount
<
5
&&
search
(
sb
.
toString
()))
addClassName
(
entry
.
getName
());
}
if
(
nonprintableCharactersCount
<
5
&&
search
(
sb
.
toString
()))
addClassName
(
entry
.
getName
());
}
}
setSearching
(
false
);
if
(
findButton
.
getText
().
equals
(
"Stop"
))
{
setStatus
(
"Done."
);
findButton
.
setText
(
"Find"
);
locked
=
false
;
}
jfile
.
close
();
locked
=
false
;
}
catch
(
Exception
e
)
{
Luyten
.
showExceptionDialog
(
"Exception!"
,
e
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录