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
aa41a4d9
Commit
aa41a4d9
authored
Apr 22, 2019
by
Ahmed Ashour
Committed by
skylot
Apr 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(gui): add "Go To Declaration" in menu (PR #618)
parent
61675275
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
0 deletions
+72
-0
CodeArea.java
jadx-gui/src/main/java/jadx/gui/ui/codearea/CodeArea.java
+3
-0
GoToDeclarationAction.java
...main/java/jadx/gui/ui/codearea/GoToDeclarationAction.java
+66
-0
Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+1
-0
Messages_es_ES.properties
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
+1
-0
Messages_zh_CN.properties
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
+1
-0
No files found.
jadx-gui/src/main/java/jadx/gui/ui/codearea/CodeArea.java
View file @
aa41a4d9
...
...
@@ -96,11 +96,14 @@ public final class CodeArea extends RSyntaxTextArea {
private
void
addMenuItems
(
JClass
jCls
)
{
FindUsageAction
findUsage
=
new
FindUsageAction
(
contentPanel
,
this
,
jCls
);
GoToDeclarationAction
goToDeclaration
=
new
GoToDeclarationAction
(
contentPanel
,
this
,
jCls
);
JPopupMenu
popup
=
getPopupMenu
();
popup
.
addSeparator
();
popup
.
add
(
findUsage
);
popup
.
add
(
goToDeclaration
);
popup
.
addPopupMenuListener
(
findUsage
);
popup
.
addPopupMenuListener
(
goToDeclaration
);
}
public
void
loadSettings
()
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/codearea/GoToDeclarationAction.java
0 → 100644
View file @
aa41a4d9
package
jadx
.
gui
.
ui
.
codearea
;
import
java.awt.Point
;
import
java.awt.event.ActionEvent
;
import
javax.swing.AbstractAction
;
import
javax.swing.event.PopupMenuEvent
;
import
javax.swing.event.PopupMenuListener
;
import
org.fife.ui.rsyntaxtextarea.Token
;
import
jadx.api.JavaNode
;
import
jadx.gui.treemodel.JClass
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.ui.MainWindow
;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.NLS
;
public
final
class
GoToDeclarationAction
extends
AbstractAction
implements
PopupMenuListener
{
private
static
final
long
serialVersionUID
=
-
1186470538894941301L
;
private
final
transient
CodePanel
contentPanel
;
private
final
transient
CodeArea
codeArea
;
private
final
transient
JClass
jCls
;
private
transient
JavaNode
node
;
public
GoToDeclarationAction
(
CodePanel
contentPanel
,
CodeArea
codeArea
,
JClass
jCls
)
{
super
(
NLS
.
str
(
"popup.go_to_declaration"
));
this
.
contentPanel
=
contentPanel
;
this
.
codeArea
=
codeArea
;
this
.
jCls
=
jCls
;
}
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
node
==
null
)
{
return
;
}
MainWindow
mainWindow
=
contentPanel
.
getTabbedPane
().
getMainWindow
();
JNode
jNode
=
mainWindow
.
getCacheObject
().
getNodeCache
().
makeFrom
(
node
);
mainWindow
.
getTabbedPane
().
codeJump
(
new
JumpPosition
(
jNode
,
jNode
.
getLine
()));
}
@Override
public
void
popupMenuWillBecomeVisible
(
PopupMenuEvent
e
)
{
node
=
null
;
Point
pos
=
codeArea
.
getMousePosition
();
if
(
pos
!=
null
)
{
Token
token
=
codeArea
.
viewToToken
(
pos
);
if
(
token
!=
null
)
{
node
=
codeArea
.
getJavaNodeAtOffset
(
jCls
,
token
.
getOffset
());
}
}
setEnabled
(
node
!=
null
);
}
@Override
public
void
popupMenuWillBecomeInvisible
(
PopupMenuEvent
e
)
{
// do nothing
}
@Override
public
void
popupMenuCanceled
(
PopupMenuEvent
e
)
{
// do nothing
}
}
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
View file @
aa41a4d9
...
...
@@ -136,6 +136,7 @@ popup.paste=Paste
popup.delete
=
Delete
popup.select_all
=
Select All
popup.find_usage
=
Find Usage
popup.go_to_declaration
=
Go to declaration
popup.exclude
=
Exclude
confirm.save_as_title
=
Confirm Save as
...
...
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
View file @
aa41a4d9
...
...
@@ -136,6 +136,7 @@ popup.paste=Pegar
popup.delete
=
Borrar
popup.select_all
=
Seleccionar todo
#popup.find_usage=
#popup.go_to_declaration=
#popup.exclude=
#confirm.save_as_title=
...
...
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
View file @
aa41a4d9
...
...
@@ -136,6 +136,7 @@ popup.paste=粘贴
popup.delete
=
删除
popup.select_all
=
全选
popup.find_usage
=
查找用例
#popup.go_to_declaration=
#popup.exclude=
#confirm.save_as_title=
...
...
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