Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
fef3e55c
J
jadx
项目概览
Quincy379
/
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,体验更适合开发者的 AI 搜索 >>
提交
fef3e55c
编写于
5月 10, 2019
作者:
J
Jan S
提交者:
skylot
5月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(gui): select a class to open via command-line (PR #658)
上级
6f973ca2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
70 addition
and
4 deletion
+70
-4
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
+5
-1
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
+11
-1
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
+15
-1
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
.../src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
+14
-1
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+16
-0
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+3
-0
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
+3
-0
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
+3
-0
未找到文件。
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
浏览文件 @
fef3e55c
...
...
@@ -130,7 +130,7 @@ public class JadxCLIArgs {
* Used to merge saved options and options passed in command line.
*/
public
boolean
overrideProvided
(
String
[]
args
)
{
JCommanderWrapper
<
JadxCLIArgs
>
jcw
=
new
JCommanderWrapper
<>(
new
JadxCLIArgs
());
JCommanderWrapper
<
JadxCLIArgs
>
jcw
=
new
JCommanderWrapper
<>(
new
Instance
());
if
(!
jcw
.
parse
(
args
))
{
return
false
;
}
...
...
@@ -138,6 +138,10 @@ public class JadxCLIArgs {
return
process
(
jcw
);
}
protected
JadxCLIArgs
newInstance
()
{
return
new
JadxCLIArgs
();
}
private
boolean
process
(
JCommanderWrapper
<
JadxCLIArgs
>
jcw
)
{
if
(
printHelp
)
{
jcw
.
printUsage
();
...
...
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
浏览文件 @
fef3e55c
...
...
@@ -8,8 +8,9 @@ import java.util.List;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.stream.Collectors
;
import
javax.swing.
*
;
import
javax.swing.
ProgressMonitor
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -133,4 +134,13 @@ public class JadxWrapper {
public
JadxArgs
getArgs
()
{
return
decompiler
.
getArgs
();
}
/**
* @param fullName Full name of an outer class. Inner classes are not supported.
* @return
*/
public
@Nullable
JavaClass
searchJavaClassByClassName
(
String
fullName
)
{
return
decompiler
.
getClasses
().
stream
().
filter
(
cls
->
cls
.
getFullName
().
equals
(
fullName
))
.
findFirst
().
orElse
(
null
);
}
}
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
浏览文件 @
fef3e55c
...
...
@@ -15,13 +15,15 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.function.Consumer
;
import
javax.swing.
*
;
import
javax.swing.
JFrame
;
import
org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.beust.jcommander.Parameter
;
import
jadx.api.JadxArgs
;
import
jadx.cli.JadxCLIArgs
;
import
jadx.gui.ui.MainWindow
;
...
...
@@ -65,6 +67,10 @@ public class JadxSettings extends JadxCLIArgs {
private
int
settingsVersion
=
0
;
@JadxSettingsAdapter
.
GsonExclude
@Parameter
(
names
=
{
"-sc"
,
"--select-class"
},
description
=
"GUI: Open the selected class and show the decompiled code"
)
private
String
cmdSelectClass
=
null
;
public
static
JadxSettings
makeDefault
()
{
JadxSettings
jadxSettings
=
new
JadxSettings
();
jadxSettings
.
fixOnLoad
();
...
...
@@ -96,6 +102,10 @@ public class JadxSettings extends JadxCLIArgs {
}
}
public
String
getCmdSelectClass
()
{
return
cmdSelectClass
;
}
public
Path
getLastOpenFilePath
()
{
return
lastOpenFilePath
;
}
...
...
@@ -412,4 +422,8 @@ public class JadxSettings extends JadxCLIArgs {
sync
();
}
@Override
protected
JadxCLIArgs
newInstance
()
{
return
new
JadxSettings
();
}
}
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
浏览文件 @
fef3e55c
package
jadx.gui.settings
;
import
java.awt.Rectangle
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.lang.reflect.Modifier
;
import
java.nio.file.Path
;
import
java.util.prefs.Preferences
;
...
...
@@ -31,7 +35,8 @@ public class JadxSettingsAdapter {
public
boolean
shouldSkipField
(
FieldAttributes
f
)
{
return
JadxSettings
.
SKIP_FIELDS
.
contains
(
f
.
getName
())
||
f
.
hasModifier
(
Modifier
.
PUBLIC
)
||
f
.
hasModifier
(
Modifier
.
TRANSIENT
);
||
f
.
hasModifier
(
Modifier
.
TRANSIENT
)
||
(
f
.
getAnnotation
(
GsonExclude
.
class
)
!=
null
);
}
@Override
...
...
@@ -96,4 +101,12 @@ public class JadxSettingsAdapter {
.
create
()
.
fromJson
(
json
,
type
);
}
/**
* Annotation for specifying fields that should not be be saved/loaded
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
GsonExclude
{
}
}
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
浏览文件 @
fef3e55c
...
...
@@ -67,6 +67,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
jadx.api.JadxArgs
;
import
jadx.api.JavaNode
;
import
jadx.api.ResourceFile
;
import
jadx.gui.JadxWrapper
;
import
jadx.gui.jobs.BackgroundWorker
;
...
...
@@ -178,10 +179,25 @@ public class MainWindow extends JFrame {
}
});
processCommandLineArgs
();
}
private
void
processCommandLineArgs
()
{
if
(
settings
.
getFiles
().
isEmpty
())
{
openFileOrProject
();
}
else
{
open
(
Paths
.
get
(
settings
.
getFiles
().
get
(
0
)));
if
(
settings
.
getCmdSelectClass
()
!=
null
)
{
JavaNode
javaNode
=
wrapper
.
searchJavaClassByClassName
(
settings
.
getCmdSelectClass
());
if
(
javaNode
==
null
)
{
JOptionPane
.
showMessageDialog
(
this
,
NLS
.
str
(
"msg.cmd_select_class_error"
,
settings
.
getCmdSelectClass
()),
NLS
.
str
(
"error_dialog.title"
),
JOptionPane
.
ERROR_MESSAGE
);
}
else
{
JNode
node
=
cacheObject
.
getNodeCache
().
makeFrom
(
javaNode
);
tabbedPane
.
codeJump
(
new
JumpPosition
(
node
.
getRootClass
(),
node
.
getLine
()));
}
}
}
}
...
...
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
浏览文件 @
fef3e55c
...
...
@@ -32,6 +32,8 @@ tree.sources_title=Source code
tree.resources_title
=
Resources
tree.loading
=
Loading...
error_dialog.title
=
Error
search.previous
=
Previous
search.next
=
Next
search.mark_all
=
Mark All
...
...
@@ -131,6 +133,7 @@ msg.project_error_title=Error
msg.project_error
=
Project could not be loaded
msg.rename_disabled_title
=
Rename disabled
msg.rename_disabled
=
Some of rename settings are disabled, please take this into consideration
msg.cmd_select_class_error
=
Failed to select the class
\n
%s
\n
The class does not exist.
popup.undo
=
Undo
popup.redo
=
Redo
...
...
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
浏览文件 @
fef3e55c
...
...
@@ -32,6 +32,8 @@ tree.sources_title=Código fuente
tree.resources_title
=
Recursos
tree.loading
=
Cargando...
#error_dialog.title=
search.previous
=
Anterior
search.next
=
Siguiente
search.mark_all
=
Marcar todo
...
...
@@ -131,6 +133,7 @@ msg.index_not_initialized=Índice no inicializado, ¡la bósqueda se desactivar
#msg.project_error=
#msg.rename_disabled_title=
#msg.rename_disabled=
#msg.cmd_select_class_error=
popup.undo
=
Deshacer
popup.redo
=
Rehacer
...
...
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
浏览文件 @
fef3e55c
...
...
@@ -32,6 +32,8 @@ tree.sources_title=源代码
tree.resources_title
=
资源文件
tree.loading
=
稍等...
#error_dialog.title=
search.previous
=
上一个
search.next
=
下一个
search.mark_all
=
标记全部
...
...
@@ -131,6 +133,7 @@ msg.index_not_initialized=索引尚未初始化,无法进行搜索!
#msg.project_error=
#msg.rename_disabled_title=
#msg.rename_disabled=
#msg.cmd_select_class_error=
popup.undo
=
撤销
popup.redo
=
重做
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录