Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
f0a57e67
J
jadx
项目概览
keyescgm
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f0a57e67
编写于
8月 17, 2016
作者:
J
Jan Peter Stotz
提交者:
Jan Peter Stotz
2月 12, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
case insensitive option for searches
上级
d9b0365c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
80 addition
and
34 deletion
+80
-34
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
+2
-1
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
+29
-12
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
+7
-0
jadx-gui/src/main/java/jadx/gui/utils/search/CodeIndex.java
jadx-gui/src/main/java/jadx/gui/utils/search/CodeIndex.java
+6
-3
jadx-gui/src/main/java/jadx/gui/utils/search/SearchIndex.java
...-gui/src/main/java/jadx/gui/utils/search/SearchIndex.java
+1
-1
jadx-gui/src/main/java/jadx/gui/utils/search/SimpleIndex.java
...-gui/src/main/java/jadx/gui/utils/search/SimpleIndex.java
+8
-2
jadx-gui/src/main/java/jadx/gui/utils/search/StringRef.java
jadx-gui/src/main/java/jadx/gui/utils/search/StringRef.java
+17
-7
jadx-gui/src/main/java/jadx/gui/utils/search/TextSearchIndex.java
.../src/main/java/jadx/gui/utils/search/TextSearchIndex.java
+8
-8
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+2
-0
未找到文件。
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
浏览文件 @
f0a57e67
...
...
@@ -54,6 +54,7 @@ public abstract class CommonSearchDialog extends JDialog {
protected
ProgressPanel
progressPane
;
protected
String
highlightText
;
protected
boolean
highlightTextCaseInsensitive
=
false
;
public
CommonSearchDialog
(
MainWindow
mainWindow
)
{
super
(
mainWindow
);
...
...
@@ -359,7 +360,7 @@ public abstract class CommonSearchDialog extends JDialog {
textArea
.
setColumns
(
textArea
.
getText
().
length
());
if
(
highlightText
!=
null
)
{
SearchContext
searchContext
=
new
SearchContext
(
highlightText
);
searchContext
.
setMatchCase
(
tru
e
);
searchContext
.
setMatchCase
(
!
highlightTextCaseInsensitiv
e
);
searchContext
.
setMarkAll
(
true
);
SearchEngine
.
markAll
(
textArea
,
searchContext
);
}
...
...
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
浏览文件 @
f0a57e67
...
...
@@ -31,6 +31,7 @@ public class SearchDialog extends CommonSearchDialog {
private
Set
<
SearchOptions
>
options
=
EnumSet
.
allOf
(
SearchOptions
.
class
);
private
JTextField
searchField
;
private
JCheckBox
caseChBox
;
public
SearchDialog
(
MainWindow
mainWindow
,
Set
<
SearchOptions
>
options
)
{
super
(
mainWindow
);
...
...
@@ -65,19 +66,21 @@ public class SearchDialog extends CommonSearchDialog {
resultsTable
.
updateTable
();
return
;
}
boolean
caseInsensitive
=
caseChBox
.
isSelected
();
if
(
options
.
contains
(
SearchOptions
.
CLASS
))
{
resultsModel
.
addAll
(
index
.
searchClsName
(
text
));
resultsModel
.
addAll
(
index
.
searchClsName
(
text
,
caseInsensitive
));
}
if
(
options
.
contains
(
SearchOptions
.
METHOD
))
{
resultsModel
.
addAll
(
index
.
searchMthName
(
text
));
resultsModel
.
addAll
(
index
.
searchMthName
(
text
,
caseInsensitive
));
}
if
(
options
.
contains
(
SearchOptions
.
FIELD
))
{
resultsModel
.
addAll
(
index
.
searchFldName
(
text
));
resultsModel
.
addAll
(
index
.
searchFldName
(
text
,
caseInsensitive
));
}
if
(
options
.
contains
(
SearchOptions
.
CODE
))
{
resultsModel
.
addAll
(
index
.
searchCode
(
text
));
resultsModel
.
addAll
(
index
.
searchCode
(
text
,
caseInsensitive
));
}
highlightText
=
text
;
highlightTextCaseInsensitive
=
caseInsensitive
;
resultsTable
.
updateTable
();
}
...
...
@@ -114,24 +117,38 @@ public class SearchDialog extends CommonSearchDialog {
private
void
initUI
()
{
JLabel
findLabel
=
new
JLabel
(
NLS
.
str
(
"search_dialog.open_by_name"
));
searchField
=
new
JTextField
();
searchField
.
setAlignmentX
(
LEFT_ALIGNMENT
);
searchField
.
getDocument
().
addDocumentListener
(
new
SearchFieldListener
());
new
TextStandardActions
(
searchField
);
caseChBox
=
new
JCheckBox
(
NLS
.
str
(
"search_dialog.ignorecase"
));
caseChBox
.
addItemListener
(
new
ItemListener
()
{
public
void
itemStateChanged
(
ItemEvent
e
)
{
performSearch
();
}
});
JCheckBox
clsChBox
=
makeOptionsCheckBox
(
NLS
.
str
(
"search_dialog.class"
),
SearchOptions
.
CLASS
);
JCheckBox
mthChBox
=
makeOptionsCheckBox
(
NLS
.
str
(
"search_dialog.method"
),
SearchOptions
.
METHOD
);
JCheckBox
fldChBox
=
makeOptionsCheckBox
(
NLS
.
str
(
"search_dialog.field"
),
SearchOptions
.
FIELD
);
JCheckBox
codeChBox
=
makeOptionsCheckBox
(
NLS
.
str
(
"search_dialog.code"
),
SearchOptions
.
CODE
);
JPanel
searchInPanel
=
new
JPanel
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
searchInPanel
.
setBorder
(
BorderFactory
.
createTitledBorder
(
NLS
.
str
(
"search_dialog.search_in"
)));
searchInPanel
.
add
(
clsChBox
);
searchInPanel
.
add
(
mthChBox
);
searchInPanel
.
add
(
fldChBox
);
searchInPanel
.
add
(
codeChBox
);
JPanel
searchOptions
=
new
JPanel
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
searchOptions
.
setBorder
(
BorderFactory
.
createTitledBorder
(
NLS
.
str
(
"search_dialog.search_in"
)));
searchOptions
.
add
(
clsChBox
);
searchOptions
.
add
(
mthChBox
);
searchOptions
.
add
(
fldChBox
);
searchOptions
.
add
(
codeChBox
);
searchOptions
.
setAlignmentX
(
LEFT_ALIGNMENT
);
searchOptions
.
setBorder
(
BorderFactory
.
createTitledBorder
(
NLS
.
str
(
"search_dialog.options"
)));
searchOptions
.
add
(
caseChBox
);
Box
box
=
Box
.
createHorizontalBox
();
box
.
setAlignmentX
(
LEFT_ALIGNMENT
);
box
.
add
(
searchInPanel
);
box
.
add
(
searchOptions
);
JPanel
searchPane
=
new
JPanel
();
searchPane
.
setLayout
(
new
BoxLayout
(
searchPane
,
BoxLayout
.
PAGE_AXIS
));
...
...
@@ -140,7 +157,7 @@ public class SearchDialog extends CommonSearchDialog {
searchPane
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
0
,
5
)));
searchPane
.
add
(
searchField
);
searchPane
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
0
,
5
)));
searchPane
.
add
(
searchOptions
);
searchPane
.
add
(
box
);
searchPane
.
setBorder
(
BorderFactory
.
createEmptyBorder
(
10
,
10
,
10
,
10
));
initCommon
();
...
...
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
浏览文件 @
f0a57e67
...
...
@@ -109,4 +109,11 @@ public class Utils {
private
static
String
format
(
long
mem
)
{
return
Long
.
toString
((
long
)
(
mem
/
1024
.
/
1024
.))
+
"MB"
;
}
/**
* Adapt character case for case insensitive searches
*/
public
static
char
caseChar
(
char
ch
,
boolean
toLower
)
{
return
toLower
?
Character
.
toLowerCase
(
ch
)
:
ch
;
}
}
jadx-gui/src/main/java/jadx/gui/utils/search/CodeIndex.java
浏览文件 @
f0a57e67
...
...
@@ -7,7 +7,7 @@ import java.util.List;
public
class
CodeIndex
<
T
>
implements
SearchIndex
<
T
>
{
private
final
List
<
StringRef
>
keys
=
new
ArrayList
<>();
private
final
List
<
T
>
values
=
new
ArrayList
<>();
private
final
List
<
T
>
values
=
new
ArrayList
<
T
>();
@Override
public
void
put
(
String
str
,
T
value
)
{
...
...
@@ -29,15 +29,18 @@ public class CodeIndex<T> implements SearchIndex<T> {
}
@Override
public
List
<
T
>
getValuesForKeysContaining
(
String
str
)
{
public
List
<
T
>
getValuesForKeysContaining
(
String
str
,
boolean
caseInsensitive
)
{
int
size
=
size
();
if
(
size
==
0
)
{
return
Collections
.
emptyList
();
}
if
(
caseInsensitive
)
{
str
=
str
.
toLowerCase
();
}
List
<
T
>
results
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
StringRef
key
=
keys
.
get
(
i
);
if
(
key
.
indexOf
(
str
)
!=
-
1
)
{
if
(
key
.
indexOf
(
str
,
caseInsensitive
)
!=
-
1
)
{
results
.
add
(
values
.
get
(
i
));
}
}
...
...
jadx-gui/src/main/java/jadx/gui/utils/search/SearchIndex.java
浏览文件 @
f0a57e67
...
...
@@ -10,7 +10,7 @@ public interface SearchIndex<V> {
boolean
isStringRefSupported
();
List
<
V
>
getValuesForKeysContaining
(
String
str
);
List
<
V
>
getValuesForKeysContaining
(
String
str
,
boolean
caseInsensitive
);
int
size
();
}
jadx-gui/src/main/java/jadx/gui/utils/search/SimpleIndex.java
浏览文件 @
f0a57e67
...
...
@@ -7,7 +7,7 @@ import java.util.List;
public
class
SimpleIndex
<
T
>
implements
SearchIndex
<
T
>
{
private
final
List
<
String
>
keys
=
new
ArrayList
<>();
private
final
List
<
T
>
values
=
new
ArrayList
<>();
private
final
List
<
T
>
values
=
new
ArrayList
<
T
>();
@Override
public
void
put
(
String
str
,
T
value
)
{
...
...
@@ -26,14 +26,20 @@ public class SimpleIndex<T> implements SearchIndex<T> {
}
@Override
public
List
<
T
>
getValuesForKeysContaining
(
String
str
)
{
public
List
<
T
>
getValuesForKeysContaining
(
String
str
,
boolean
caseInsensitive
)
{
int
size
=
size
();
if
(
size
==
0
)
{
return
Collections
.
emptyList
();
}
if
(
caseInsensitive
)
{
str
=
str
.
toLowerCase
();
}
List
<
T
>
results
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
String
key
=
keys
.
get
(
i
);
if
(
caseInsensitive
)
{
key
=
key
.
toLowerCase
();
}
if
(
key
.
contains
(
str
))
{
results
.
add
(
values
.
get
(
i
));
}
...
...
jadx-gui/src/main/java/jadx/gui/utils/search/StringRef.java
浏览文件 @
f0a57e67
package
jadx.gui.utils.search
;
import
static
jadx
.
gui
.
utils
.
Utils
.
caseChar
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -68,13 +69,21 @@ public class StringRef implements CharSequence {
return
indexOf
(
str
,
0
);
}
public
int
indexOf
(
String
str
,
boolean
caseInsensitive
)
{
return
indexOf
(
str
,
0
,
caseInsensitive
);
}
public
int
indexOf
(
String
str
,
int
from
,
boolean
caseInsensitive
)
{
return
indexOf
(
refStr
,
offset
,
length
,
str
,
0
,
str
.
length
(),
from
,
caseInsensitive
);
}
public
int
indexOf
(
String
str
,
int
from
)
{
return
indexOf
(
refStr
,
offset
,
length
,
str
,
0
,
str
.
length
(),
from
);
return
indexOf
(
refStr
,
offset
,
length
,
str
,
0
,
str
.
length
(),
from
,
false
);
}
private
static
int
indexOf
(
String
source
,
int
sourceOffset
,
int
sourceCount
,
String
target
,
int
targetOffset
,
int
targetCount
,
int
fromIndex
)
{
int
fromIndex
,
boolean
caseInsensitive
)
{
if
(
fromIndex
>=
sourceCount
)
{
return
(
targetCount
==
0
?
sourceCount
:
-
1
);
}
...
...
@@ -84,18 +93,18 @@ public class StringRef implements CharSequence {
if
(
targetCount
==
0
)
{
return
-
1
;
}
char
first
=
target
.
charAt
(
targetOffset
);
char
first
=
caseChar
(
target
.
charAt
(
targetOffset
),
caseInsensitive
);
int
max
=
sourceOffset
+
(
sourceCount
-
targetCount
);
for
(
int
i
=
sourceOffset
+
fromIndex
;
i
<=
max
;
i
++)
{
if
(
source
.
charAt
(
i
)
!=
first
)
{
while
(++
i
<=
max
&&
source
.
charAt
(
i
)
!=
first
)
{
if
(
caseChar
(
source
.
charAt
(
i
),
caseInsensitive
)
!=
first
)
{
while
(++
i
<=
max
&&
caseChar
(
source
.
charAt
(
i
),
caseInsensitive
)
!=
first
)
{
}
}
if
(
i
<=
max
)
{
int
j
=
i
+
1
;
int
end
=
j
+
targetCount
-
1
;
int
k
=
targetOffset
+
1
;
while
(
j
<
end
&&
source
.
charAt
(
j
)
==
target
.
charAt
(
k
))
{
while
(
j
<
end
&&
caseChar
(
source
.
charAt
(
j
),
caseInsensitive
)
==
caseChar
(
target
.
charAt
(
k
),
caseInsensitive
))
{
j
++;
k
++;
}
...
...
@@ -117,7 +126,7 @@ public class StringRef implements CharSequence {
List
<
StringRef
>
list
=
new
ArrayList
<>();
while
(
true
)
{
int
start
=
pos
+
targetLen
;
pos
=
indexOf
(
str
,
0
,
len
,
splitBy
,
0
,
targetLen
,
start
);
pos
=
indexOf
(
str
,
0
,
len
,
splitBy
,
0
,
targetLen
,
start
,
false
);
if
(
pos
==
-
1
)
{
if
(
start
!=
len
)
{
list
.
add
(
subString
(
str
,
start
,
len
));
...
...
@@ -178,4 +187,5 @@ public class StringRef implements CharSequence {
int
offset
=
this
.
offset
;
return
refStr
.
substring
(
offset
,
offset
+
len
);
}
}
jadx-gui/src/main/java/jadx/gui/utils/search/TextSearchIndex.java
浏览文件 @
f0a57e67
...
...
@@ -73,22 +73,22 @@ public class TextSearchIndex {
}
}
public
List
<
JNode
>
searchClsName
(
String
text
)
{
return
clsNamesIndex
.
getValuesForKeysContaining
(
text
);
public
List
<
JNode
>
searchClsName
(
String
text
,
boolean
caseInsensitive
)
{
return
clsNamesIndex
.
getValuesForKeysContaining
(
text
,
caseInsensitive
);
}
public
List
<
JNode
>
searchMthName
(
String
text
)
{
return
mthNamesIndex
.
getValuesForKeysContaining
(
text
);
public
List
<
JNode
>
searchMthName
(
String
text
,
boolean
caseInsensitive
)
{
return
mthNamesIndex
.
getValuesForKeysContaining
(
text
,
caseInsensitive
);
}
public
List
<
JNode
>
searchFldName
(
String
text
)
{
return
fldNamesIndex
.
getValuesForKeysContaining
(
text
);
public
List
<
JNode
>
searchFldName
(
String
text
,
boolean
caseInsensitive
)
{
return
fldNamesIndex
.
getValuesForKeysContaining
(
text
,
caseInsensitive
);
}
public
List
<
CodeNode
>
searchCode
(
String
text
)
{
public
List
<
CodeNode
>
searchCode
(
String
text
,
boolean
caseInsensitive
)
{
List
<
CodeNode
>
items
;
if
(
codeIndex
.
size
()
>
0
)
{
items
=
codeIndex
.
getValuesForKeysContaining
(
text
);
items
=
codeIndex
.
getValuesForKeysContaining
(
text
,
caseInsensitive
);
if
(
skippedClasses
.
isEmpty
())
{
return
items
;
}
...
...
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
浏览文件 @
f0a57e67
...
...
@@ -49,6 +49,8 @@ search_dialog.class=Class
search_dialog.method
=
Method
search_dialog.field
=
Field
search_dialog.code
=
Code
search_dialog.options
=
Search options
\:
search_dialog.ignorecase
=
Case insensitive
usage_dialog.title
=
Usage search
usage_dialog.label
=
Usage for:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录