Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
4a0aacf1
Commit
4a0aacf1
authored
Dec 28, 2013
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui: fix inner classes opening
parent
917cf20d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
22 deletions
+61
-22
JavaClass.java
jadx-core/src/main/java/jadx/api/JavaClass.java
+10
-1
MainWindow.java
jadx-gui/src/main/java/jadx/gui/MainWindow.java
+4
-5
JClass.java
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
+21
-11
JField.java
jadx-gui/src/main/java/jadx/gui/treemodel/JField.java
+11
-2
JMethod.java
jadx-gui/src/main/java/jadx/gui/treemodel/JMethod.java
+8
-3
JNode.java
jadx-gui/src/main/java/jadx/gui/treemodel/JNode.java
+7
-0
No files found.
jadx-core/src/main/java/jadx/api/JavaClass.java
View file @
4a0aacf1
...
...
@@ -6,6 +6,7 @@ import jadx.core.dex.info.AccessInfo;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.FieldNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -27,14 +28,22 @@ public final class JavaClass {
}
public
void
decompile
()
{
if
(
decompiler
==
null
)
{
throw
new
JadxRuntimeException
(
"Can't decompile inner class"
);
}
decompiler
.
processClass
(
cls
);
load
();
}
private
void
load
()
{
int
inClsCount
=
cls
.
getInnerClasses
().
size
();
if
(
inClsCount
!=
0
)
{
List
<
JavaClass
>
list
=
new
ArrayList
<
JavaClass
>(
inClsCount
);
for
(
ClassNode
inner
:
cls
.
getInnerClasses
())
{
if
(!
inner
.
getAttributes
().
contains
(
AttributeFlag
.
DONT_GENERATE
))
{
list
.
add
(
new
JavaClass
(
decompiler
,
inner
));
JavaClass
javaClass
=
new
JavaClass
(
null
,
inner
);
javaClass
.
load
();
list
.
add
(
javaClass
);
}
}
this
.
innerClasses
=
Collections
.
unmodifiableList
(
list
);
...
...
jadx-gui/src/main/java/jadx/gui/MainWindow.java
View file @
4a0aacf1
...
...
@@ -149,10 +149,9 @@ public class MainWindow extends JFrame {
Object
obj
=
tree
.
getLastSelectedPathComponent
();
if
(
obj
instanceof
JNode
)
{
JNode
node
=
(
JNode
)
obj
;
if
(
node
.
getJParent
()
!=
null
)
{
showCode
(
node
.
getJParent
(),
node
.
getLine
());
}
else
if
(
node
.
getClass
()
==
JClass
.
class
)
{
showCode
((
JClass
)
node
,
node
.
getLine
());
JClass
cls
=
node
.
getRootClass
();
if
(
cls
!=
null
)
{
showCode
(
cls
,
node
.
getLine
());
}
}
}
...
...
@@ -392,7 +391,7 @@ public class MainWindow extends JFrame {
Object
node
=
path
.
getLastPathComponent
();
if
(
node
instanceof
JClass
)
{
JClass
cls
=
(
JClass
)
node
;
cls
.
load
();
cls
.
getRootClass
().
load
();
}
}
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
View file @
4a0aacf1
...
...
@@ -22,11 +22,19 @@ public class JClass extends JNode {
private
static
final
ImageIcon
ICON_ANNOTATION
=
Utils
.
openIcon
(
"annotation_obj"
);
private
final
JavaClass
cls
;
private
JClass
jPar
rent
;
private
final
JClass
jPa
rent
;
private
boolean
loaded
;
public
JClass
(
JavaClass
cls
)
{
this
.
cls
=
cls
;
this
.
jParent
=
null
;
this
.
loaded
=
false
;
}
public
JClass
(
JavaClass
cls
,
JClass
parent
)
{
this
.
cls
=
cls
;
this
.
jParent
=
parent
;
this
.
loaded
=
true
;
}
public
JavaClass
getCls
()
{
...
...
@@ -47,18 +55,16 @@ public class JClass extends JNode {
if
(!
loaded
)
{
add
(
new
TextNode
(
NLS
.
str
(
"tree.loading"
)));
}
else
{
JClass
currentParent
=
jParrent
==
null
?
this
:
jParrent
;
for
(
JavaClass
javaClass
:
cls
.
getInnerClasses
())
{
JClass
child
=
new
JClass
(
javaClass
);
child
.
setJParent
(
currentParent
);
child
.
updateChilds
();
JClass
child
=
new
JClass
(
javaClass
,
this
);
add
(
child
);
child
.
updateChilds
();
}
for
(
JavaField
f
:
cls
.
getFields
())
{
add
(
new
JField
(
f
,
currentParent
));
add
(
new
JField
(
f
,
this
));
}
for
(
JavaMethod
m
:
cls
.
getMethods
())
{
add
(
new
JMethod
(
m
,
currentParent
));
add
(
new
JMethod
(
m
,
this
));
}
}
}
...
...
@@ -88,13 +94,17 @@ public class JClass extends JNode {
}
}
public
void
setJParent
(
JClass
parent
)
{
this
.
jParrent
=
parent
;
@Override
public
JClass
getJParent
()
{
return
jParent
;
}
@Override
public
JClass
getJParent
()
{
return
jParrent
;
public
JClass
getRootClass
()
{
if
(
jParent
==
null
)
{
return
this
;
}
return
jParent
.
getRootClass
();
}
@Override
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JField.java
View file @
4a0aacf1
...
...
@@ -37,6 +37,11 @@ public class JField extends JNode {
}
@Override
public
JClass
getRootClass
()
{
return
jParent
.
getRootClass
();
}
@Override
public
int
getLine
()
{
return
field
.
getDecompiledLine
();
}
...
...
@@ -45,8 +50,12 @@ public class JField extends JNode {
public
Icon
getIcon
()
{
AccessInfo
af
=
field
.
getAccessFlags
();
OverlayIcon
icon
=
Utils
.
makeIcon
(
af
,
ICON_FLD_PUB
,
ICON_FLD_PRI
,
ICON_FLD_PRO
,
ICON_FLD_DEF
);
if
(
af
.
isTransient
())
icon
.
add
(
ICON_TRANSIENT
);
if
(
af
.
isVolatile
())
icon
.
add
(
ICON_VOLATILE
);
if
(
af
.
isTransient
())
{
icon
.
add
(
ICON_TRANSIENT
);
}
if
(
af
.
isVolatile
())
{
icon
.
add
(
ICON_VOLATILE
);
}
return
icon
;
}
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JMethod.java
View file @
4a0aacf1
...
...
@@ -22,11 +22,11 @@ public class JMethod extends JNode {
private
static
final
ImageIcon
ICON_SYNC
=
Utils
.
openIcon
(
"synch_co"
);
private
final
JavaMethod
mth
;
private
final
JClass
j
p
arent
;
private
final
JClass
j
P
arent
;
public
JMethod
(
JavaMethod
javaMethod
,
JClass
jClass
)
{
this
.
mth
=
javaMethod
;
this
.
j
p
arent
=
jClass
;
this
.
j
P
arent
=
jClass
;
}
@Override
...
...
@@ -35,7 +35,12 @@ public class JMethod extends JNode {
@Override
public
JClass
getJParent
()
{
return
jparent
;
return
jParent
;
}
@Override
public
JClass
getRootClass
()
{
return
jParent
.
getRootClass
();
}
@Override
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JNode.java
View file @
4a0aacf1
...
...
@@ -7,6 +7,13 @@ public abstract class JNode extends DefaultMutableTreeNode {
public
abstract
JClass
getJParent
();
/**
* Return top level JClass or self if already at top.
*/
public
JClass
getRootClass
()
{
return
null
;
}
public
abstract
int
getLine
();
public
abstract
void
updateChilds
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment