Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_39073359
jadx
提交
c4cdd851
J
jadx
项目概览
qq_39073359
/
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 搜索 >>
提交
c4cdd851
编写于
7月 23, 2013
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gui: add fields and methods to tree
上级
25b2c8fe
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
230 addition
and
25 deletion
+230
-25
NOTICE
NOTICE
+36
-2
jadx-gui/src/main/java/jadx/gui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/MainWindow.java
+21
-19
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
+34
-4
jadx-gui/src/main/java/jadx/gui/treemodel/JField.java
jadx-gui/src/main/java/jadx/gui/treemodel/JField.java
+57
-0
jadx-gui/src/main/java/jadx/gui/treemodel/JMethod.java
jadx-gui/src/main/java/jadx/gui/treemodel/JMethod.java
+57
-0
jadx-gui/src/main/java/jadx/gui/treemodel/JNode.java
jadx-gui/src/main/java/jadx/gui/treemodel/JNode.java
+4
-0
jadx-gui/src/main/java/jadx/gui/treemodel/JPackage.java
jadx-gui/src/main/java/jadx/gui/treemodel/JPackage.java
+11
-0
jadx-gui/src/main/java/jadx/gui/treemodel/JRoot.java
jadx-gui/src/main/java/jadx/gui/treemodel/JRoot.java
+10
-0
jadx-gui/src/main/resources/icons-16/field_default_obj.png
jadx-gui/src/main/resources/icons-16/field_default_obj.png
+0
-0
未找到文件。
NOTICE
浏览文件 @
c4cdd851
...
...
@@ -2,7 +2,7 @@ The majority of jadx is written and copyrighted by me (Skylot)
and released under the Apache 2.0 license:
*******************************************************************************
Copyright 2013 Skylot
Copyright 2013
,
Skylot
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
...
...
@@ -105,7 +105,41 @@ as published by the Free Software Foundation.
*******************************************************************************
GUI icons copied from several places:
Jadx-gui components
===================
RSyntaxTextArea library licensed under modified BSD liense:
*******************************************************************************
Copyright (c) 2012, Robert Futrell
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
Icons copied from several places:
- Eclipse Project (JDT UI) - licensed under EPL v1.0 (http://www.eclipse.org/legal/epl-v10.html)
- famfamfam silk icon set (http://www.famfamfam.com/lab/icons/silk/) - licensed under Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/)
jadx-gui/src/main/java/jadx/gui/MainWindow.java
浏览文件 @
c4cdd851
package
jadx.gui
;
import
jadx.api.JavaClass
;
import
jadx.cli.JadxArgs
;
import
jadx.gui.treemodel.JClass
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.treemodel.JRoot
;
...
...
@@ -23,10 +21,10 @@ import javax.swing.event.TreeSelectionEvent;
import
javax.swing.event.TreeSelectionListener
;
import
javax.swing.filechooser.FileFilter
;
import
javax.swing.filechooser.FileNameExtensionFilter
;
import
javax.swing.text.BadLocationException
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultTreeCellRenderer
;
import
javax.swing.tree.DefaultTreeModel
;
import
javax.swing.tree.TreePath
;
import
javax.swing.tree.TreeSelectionModel
;
import
java.awt.BorderLayout
;
import
java.awt.Color
;
...
...
@@ -76,7 +74,6 @@ public class MainWindow extends JFrame {
treeModel
.
setRoot
(
treeRoot
);
treeModel
.
reload
();
tree
.
expandRow
(
0
);
// expandTree();
}
private
void
toggleFlattenPackage
()
{
...
...
@@ -89,15 +86,26 @@ public class MainWindow extends JFrame {
}
}
private
void
expandTree
()
{
DefaultMutableTreeNode
currentNode
=
((
DefaultMutableTreeNode
)
tree
.
getModel
().
getRoot
()).
getNextNode
();
do
{
if
(
currentNode
.
getLevel
()
==
1
)
{
tree
.
expandPath
(
new
TreePath
(
currentNode
.
getPath
()));
private
void
treeClickAction
()
{
Object
obj
=
tree
.
getLastSelectedPathComponent
();
if
(
obj
instanceof
JNode
)
{
JNode
node
=
(
JNode
)
obj
;
if
(
node
.
getJParent
()
!=
null
)
{
textArea
.
setText
(
node
.
getJParent
().
getCode
());
scrollToLine
(
node
.
getLine
());
}
currentNode
=
currentNode
.
getNextNode
();
}
while
(
currentNode
!=
null
);
}
private
void
scrollToLine
(
int
line
)
{
if
(
line
<
2
)
{
return
;
}
try
{
textArea
.
setCaretPosition
(
textArea
.
getLineStartOffset
(
line
-
1
));
}
catch
(
BadLocationException
e
)
{
LOG
.
error
(
"Can't scroll to "
+
line
,
e
);
}
}
private
void
initMenuAndToolbar
()
{
...
...
@@ -165,14 +173,8 @@ public class MainWindow extends JFrame {
tree
.
getSelectionModel
().
setSelectionMode
(
TreeSelectionModel
.
SINGLE_TREE_SELECTION
);
tree
.
addTreeSelectionListener
(
new
TreeSelectionListener
()
{
@Override
public
void
valueChanged
(
TreeSelectionEvent
e
)
{
Object
obj
=
tree
.
getLastSelectedPathComponent
();
if
(
obj
instanceof
JClass
)
{
JavaClass
jc
=
((
JClass
)
obj
).
getCls
();
String
code
=
jc
.
getCode
();
textArea
.
setText
(
code
);
textArea
.
setCaretPosition
(
0
);
}
public
void
valueChanged
(
TreeSelectionEvent
event
)
{
treeClickAction
();
}
});
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
浏览文件 @
c4cdd851
package
jadx.gui.treemodel
;
import
jadx.api.JavaClass
;
import
jadx.api.JavaField
;
import
jadx.api.JavaMethod
;
import
jadx.core.dex.info.AccessInfo
;
import
jadx.gui.Utils
;
...
...
@@ -19,10 +21,10 @@ public class JClass extends DefaultMutableTreeNode implements JNode {
private
static
final
ImageIcon
ICON_ANNOTATION
=
Utils
.
openIcon
(
"annotation_obj"
);
private
final
JavaClass
cls
;
private
JClass
jParrent
;
public
JClass
(
JavaClass
cls
)
{
this
.
cls
=
cls
;
updateChilds
();
}
public
JavaClass
getCls
()
{
...
...
@@ -31,9 +33,23 @@ public class JClass extends DefaultMutableTreeNode implements JNode {
@Override
public
void
updateChilds
()
{
// for (JavaClass javaClass : cls.getInnerClasses()) {
// add(new JClass(javaClass));
// }
JClass
currentParent
=
jParrent
==
null
?
this
:
jParrent
;
for
(
JavaClass
javaClass
:
cls
.
getInnerClasses
())
{
JClass
child
=
new
JClass
(
javaClass
);
child
.
setJParent
(
currentParent
);
child
.
updateChilds
();
add
(
child
);
}
for
(
JavaField
f
:
cls
.
getFields
())
{
add
(
new
JField
(
f
,
currentParent
));
}
for
(
JavaMethod
m
:
cls
.
getMethods
())
{
add
(
new
JMethod
(
m
,
currentParent
));
}
}
public
String
getCode
(){
return
cls
.
getCode
();
}
@Override
...
...
@@ -57,6 +73,20 @@ public class JClass extends DefaultMutableTreeNode implements JNode {
}
}
public
void
setJParent
(
JClass
parent
)
{
this
.
jParrent
=
parent
;
}
@Override
public
JClass
getJParent
()
{
return
jParrent
;
}
@Override
public
int
getLine
()
{
return
cls
.
getDecompiledLine
();
}
@Override
public
String
toString
()
{
return
cls
.
getShortName
();
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JField.java
0 → 100644
浏览文件 @
c4cdd851
package
jadx.gui.treemodel
;
import
jadx.api.JavaField
;
import
jadx.core.dex.info.AccessInfo
;
import
jadx.gui.Utils
;
import
javax.swing.Icon
;
import
javax.swing.ImageIcon
;
import
javax.swing.tree.DefaultMutableTreeNode
;
public
class
JField
extends
DefaultMutableTreeNode
implements
JNode
{
private
static
final
ImageIcon
ICON_FLD_DEF
=
Utils
.
openIcon
(
"field_default_obj"
);
private
static
final
ImageIcon
ICON_FLD_PRI
=
Utils
.
openIcon
(
"field_private_obj"
);
private
static
final
ImageIcon
ICON_FLD_PRO
=
Utils
.
openIcon
(
"field_protected_obj"
);
private
static
final
ImageIcon
ICON_FLD_PUB
=
Utils
.
openIcon
(
"field_public_obj"
);
private
final
JavaField
field
;
private
final
JClass
jParent
;
public
JField
(
JavaField
javaField
,
JClass
jClass
)
{
this
.
field
=
javaField
;
this
.
jParent
=
jClass
;
}
@Override
public
void
updateChilds
()
{
}
@Override
public
JClass
getJParent
()
{
return
jParent
;
}
@Override
public
int
getLine
()
{
return
field
.
getDecompiledLine
();
}
@Override
public
Icon
getIcon
()
{
AccessInfo
af
=
field
.
getAccessFlags
();
if
(
af
.
isPublic
()){
return
ICON_FLD_PUB
;
}
else
if
(
af
.
isPrivate
())
{
return
ICON_FLD_PRI
;
}
else
if
(
af
.
isProtected
())
{
return
ICON_FLD_PRO
;
}
else
{
return
ICON_FLD_DEF
;
}
}
@Override
public
String
toString
()
{
return
field
.
getName
();
}
}
jadx-gui/src/main/java/jadx/gui/treemodel/JMethod.java
0 → 100644
浏览文件 @
c4cdd851
package
jadx.gui.treemodel
;
import
jadx.api.JavaMethod
;
import
jadx.core.dex.info.AccessInfo
;
import
jadx.gui.Utils
;
import
javax.swing.Icon
;
import
javax.swing.ImageIcon
;
import
javax.swing.tree.DefaultMutableTreeNode
;
public
class
JMethod
extends
DefaultMutableTreeNode
implements
JNode
{
private
static
final
ImageIcon
ICON_MTH_DEF
=
Utils
.
openIcon
(
"methdef_obj"
);
private
static
final
ImageIcon
ICON_MTH_PRI
=
Utils
.
openIcon
(
"methpri_obj"
);
private
static
final
ImageIcon
ICON_MTH_PRO
=
Utils
.
openIcon
(
"methpro_obj"
);
private
static
final
ImageIcon
ICON_MTH_PUB
=
Utils
.
openIcon
(
"methpub_obj"
);
private
final
JavaMethod
mth
;
private
final
JClass
jparent
;
public
JMethod
(
JavaMethod
javaMethod
,
JClass
jClass
)
{
this
.
mth
=
javaMethod
;
this
.
jparent
=
jClass
;
}
@Override
public
void
updateChilds
()
{
}
@Override
public
JClass
getJParent
()
{
return
jparent
;
}
@Override
public
int
getLine
()
{
return
mth
.
getDecompiledLine
();
}
@Override
public
Icon
getIcon
()
{
AccessInfo
af
=
mth
.
getAccessFlags
();
if
(
af
.
isPublic
())
{
return
ICON_MTH_PUB
;
}
else
if
(
af
.
isPrivate
())
{
return
ICON_MTH_PRI
;
}
else
if
(
af
.
isProtected
())
{
return
ICON_MTH_PRO
;
}
else
{
return
ICON_MTH_DEF
;
}
}
@Override
public
String
toString
()
{
return
mth
.
getName
();
}
}
jadx-gui/src/main/java/jadx/gui/treemodel/JNode.java
浏览文件 @
c4cdd851
...
...
@@ -4,6 +4,10 @@ import javax.swing.Icon;
public
interface
JNode
{
JClass
getJParent
();
int
getLine
();
void
updateChilds
();
Icon
getIcon
();
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JPackage.java
浏览文件 @
c4cdd851
...
...
@@ -40,6 +40,7 @@ public class JPackage extends DefaultMutableTreeNode implements JNode, Comparabl
add
(
pkg
);
}
for
(
JClass
cls
:
classes
)
{
cls
.
updateChilds
();
add
(
cls
);
}
}
...
...
@@ -65,6 +66,16 @@ public class JPackage extends DefaultMutableTreeNode implements JNode, Comparabl
return
PACKAGE_ICON
;
}
@Override
public
JClass
getJParent
()
{
return
null
;
}
@Override
public
int
getLine
()
{
return
0
;
}
@Override
public
int
compareTo
(
JPackage
o
)
{
return
name
.
compareTo
(
o
.
name
);
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JRoot.java
浏览文件 @
c4cdd851
...
...
@@ -118,6 +118,16 @@ public class JRoot extends DefaultMutableTreeNode implements JNode {
return
ROOT_ICON
;
}
@Override
public
JClass
getJParent
()
{
return
null
;
}
@Override
public
int
getLine
()
{
return
0
;
}
@Override
public
String
toString
()
{
File
file
=
wrapper
.
getOpenFile
();
...
...
jadx-gui/src/main/resources/icons-16/field_default_obj.png
0 → 100644
浏览文件 @
c4cdd851
218 字节
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录