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
f6d47529
Commit
f6d47529
authored
Jul 14, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui: add key shortcuts for menu actions.
parent
bd4d4f49
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
155 additions
and
189 deletions
+155
-189
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+126
-171
SearchDialog.java
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
+27
-15
Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+2
-3
No files found.
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
f6d47529
This diff is collapsed.
Click to expand it.
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
View file @
f6d47529
...
@@ -16,6 +16,7 @@ import javax.swing.BoxLayout;
...
@@ -16,6 +16,7 @@ import javax.swing.BoxLayout;
import
javax.swing.DefaultListModel
;
import
javax.swing.DefaultListModel
;
import
javax.swing.JButton
;
import
javax.swing.JButton
;
import
javax.swing.JCheckBox
;
import
javax.swing.JCheckBox
;
import
javax.swing.JComponent
;
import
javax.swing.JDialog
;
import
javax.swing.JDialog
;
import
javax.swing.JLabel
;
import
javax.swing.JLabel
;
import
javax.swing.JList
;
import
javax.swing.JList
;
...
@@ -23,6 +24,7 @@ import javax.swing.JPanel;
...
@@ -23,6 +24,7 @@ import javax.swing.JPanel;
import
javax.swing.JProgressBar
;
import
javax.swing.JProgressBar
;
import
javax.swing.JScrollPane
;
import
javax.swing.JScrollPane
;
import
javax.swing.JTextField
;
import
javax.swing.JTextField
;
import
javax.swing.KeyStroke
;
import
javax.swing.ListCellRenderer
;
import
javax.swing.ListCellRenderer
;
import
javax.swing.SwingUtilities
;
import
javax.swing.SwingUtilities
;
import
javax.swing.SwingWorker
;
import
javax.swing.SwingWorker
;
...
@@ -61,14 +63,14 @@ public class SearchDialog extends JDialog {
...
@@ -61,14 +63,14 @@ public class SearchDialog extends JDialog {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SearchDialog
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SearchDialog
.
class
);
private
static
final
int
MAX_RESULTS_COUNT
=
500
;
private
static
final
int
MAX_RESULTS_COUNT
=
500
;
private
enum
SearchOptions
{
enum
SearchOptions
{
CLASS
,
CLASS
,
METHOD
,
METHOD
,
FIELD
,
FIELD
,
CODE
CODE
}
}
private
static
final
Set
<
SearchOptions
>
OPTIONS
=
EnumSet
.
allOf
(
SearchOptions
.
class
);
private
Set
<
SearchOptions
>
options
=
EnumSet
.
allOf
(
SearchOptions
.
class
);
private
final
TabbedPane
tabbedPane
;
private
final
TabbedPane
tabbedPane
;
private
final
JadxWrapper
wrapper
;
private
final
JadxWrapper
wrapper
;
...
@@ -79,11 +81,12 @@ public class SearchDialog extends JDialog {
...
@@ -79,11 +81,12 @@ public class SearchDialog extends JDialog {
private
JList
resultsList
;
private
JList
resultsList
;
private
JProgressBar
busyBar
;
private
JProgressBar
busyBar
;
public
SearchDialog
(
MainWindow
mainWindow
,
TabbedPane
tabbedPane
,
JadxWrapper
wrapper
)
{
public
SearchDialog
(
MainWindow
mainWindow
,
Set
<
SearchOptions
>
options
)
{
super
(
mainWindow
);
super
(
mainWindow
);
this
.
tabbedPane
=
tabbedPane
;
this
.
tabbedPane
=
mainWindow
.
getTabbedPane
()
;
this
.
wrapper
=
wrapper
;
this
.
wrapper
=
mainWindow
.
getWrapper
()
;
this
.
cache
=
mainWindow
.
getCacheObject
();
this
.
cache
=
mainWindow
.
getCacheObject
();
this
.
options
=
options
;
initUI
();
initUI
();
addWindowListener
(
new
WindowAdapter
()
{
addWindowListener
(
new
WindowAdapter
()
{
...
@@ -93,6 +96,7 @@ public class SearchDialog extends JDialog {
...
@@ -93,6 +96,7 @@ public class SearchDialog extends JDialog {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
prepare
();
prepare
();
searchField
.
requestFocus
();
}
}
});
});
}
}
...
@@ -126,23 +130,23 @@ public class SearchDialog extends JDialog {
...
@@ -126,23 +130,23 @@ public class SearchDialog extends JDialog {
private
synchronized
void
performSearch
()
{
private
synchronized
void
performSearch
()
{
resultsModel
.
removeAllElements
();
resultsModel
.
removeAllElements
();
String
text
=
searchField
.
getText
();
String
text
=
searchField
.
getText
();
if
(
text
==
null
||
text
.
isEmpty
()
||
OPTIONS
.
isEmpty
())
{
if
(
text
==
null
||
text
.
isEmpty
()
||
options
.
isEmpty
())
{
return
;
return
;
}
}
TextSearchIndex
index
=
cache
.
getTextIndex
();
TextSearchIndex
index
=
cache
.
getTextIndex
();
if
(
index
==
null
)
{
if
(
index
==
null
)
{
return
;
return
;
}
}
if
(
OPTIONS
.
contains
(
SearchOptions
.
CLASS
))
{
if
(
options
.
contains
(
SearchOptions
.
CLASS
))
{
resultsModel
.
addAll
(
index
.
searchClsName
(
text
));
resultsModel
.
addAll
(
index
.
searchClsName
(
text
));
}
}
if
(
OPTIONS
.
contains
(
SearchOptions
.
METHOD
))
{
if
(
options
.
contains
(
SearchOptions
.
METHOD
))
{
resultsModel
.
addAll
(
index
.
searchMthName
(
text
));
resultsModel
.
addAll
(
index
.
searchMthName
(
text
));
}
}
if
(
OPTIONS
.
contains
(
SearchOptions
.
FIELD
))
{
if
(
options
.
contains
(
SearchOptions
.
FIELD
))
{
resultsModel
.
addAll
(
index
.
searchFldName
(
text
));
resultsModel
.
addAll
(
index
.
searchFldName
(
text
));
}
}
if
(
OPTIONS
.
contains
(
SearchOptions
.
CODE
))
{
if
(
options
.
contains
(
SearchOptions
.
CODE
))
{
resultsModel
.
addAll
(
index
.
searchCode
(
text
));
resultsModel
.
addAll
(
index
.
searchCode
(
text
));
}
}
LOG
.
info
(
"Search returned {} results"
,
resultsModel
.
size
());
LOG
.
info
(
"Search returned {} results"
,
resultsModel
.
size
());
...
@@ -321,7 +325,7 @@ public class SearchDialog extends JDialog {
...
@@ -321,7 +325,7 @@ public class SearchDialog extends JDialog {
buttonPane
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
10
,
0
)));
buttonPane
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
10
,
0
)));
buttonPane
.
add
(
cancelButton
);
buttonPane
.
add
(
cancelButton
);
final
Container
contentPane
=
getContentPane
();
Container
contentPane
=
getContentPane
();
contentPane
.
add
(
searchPane
,
BorderLayout
.
PAGE_START
);
contentPane
.
add
(
searchPane
,
BorderLayout
.
PAGE_START
);
contentPane
.
add
(
listPane
,
BorderLayout
.
CENTER
);
contentPane
.
add
(
listPane
,
BorderLayout
.
CENTER
);
contentPane
.
add
(
buttonPane
,
BorderLayout
.
PAGE_END
);
contentPane
.
add
(
buttonPane
,
BorderLayout
.
PAGE_END
);
...
@@ -339,7 +343,15 @@ public class SearchDialog extends JDialog {
...
@@ -339,7 +343,15 @@ public class SearchDialog extends JDialog {
}
}
});
});
setTitle
(
NLS
.
str
(
"menu.search"
));
KeyStroke
stroke
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_ESCAPE
,
0
);
getRootPane
().
registerKeyboardAction
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
dispose
();
}
},
stroke
,
JComponent
.
WHEN_IN_FOCUSED_WINDOW
);
setTitle
(
NLS
.
str
(
"menu.text_search"
));
pack
();
pack
();
setSize
(
700
,
500
);
setSize
(
700
,
500
);
setLocationRelativeTo
(
null
);
setLocationRelativeTo
(
null
);
...
@@ -350,13 +362,13 @@ public class SearchDialog extends JDialog {
...
@@ -350,13 +362,13 @@ public class SearchDialog extends JDialog {
private
JCheckBox
makeOptionsCheckBox
(
String
name
,
final
SearchOptions
opt
)
{
private
JCheckBox
makeOptionsCheckBox
(
String
name
,
final
SearchOptions
opt
)
{
final
JCheckBox
chBox
=
new
JCheckBox
(
name
);
final
JCheckBox
chBox
=
new
JCheckBox
(
name
);
chBox
.
setAlignmentX
(
LEFT_ALIGNMENT
);
chBox
.
setAlignmentX
(
LEFT_ALIGNMENT
);
chBox
.
setSelected
(
OPTIONS
.
contains
(
opt
));
chBox
.
setSelected
(
options
.
contains
(
opt
));
chBox
.
addItemListener
(
new
ItemListener
()
{
chBox
.
addItemListener
(
new
ItemListener
()
{
public
void
itemStateChanged
(
ItemEvent
e
)
{
public
void
itemStateChanged
(
ItemEvent
e
)
{
if
(
chBox
.
isSelected
())
{
if
(
chBox
.
isSelected
())
{
OPTIONS
.
add
(
opt
);
options
.
add
(
opt
);
}
else
{
}
else
{
OPTIONS
.
remove
(
opt
);
options
.
remove
(
opt
);
}
}
performSearch
();
performSearch
();
}
}
...
...
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
View file @
f6d47529
...
@@ -6,8 +6,8 @@ menu.preferences=Preferences
...
@@ -6,8 +6,8 @@ menu.preferences=Preferences
menu.sync
=
Sync with editor
menu.sync
=
Sync with editor
menu.flatten
=
Show flatten packages
menu.flatten
=
Show flatten packages
menu.navigation
=
Navigation
menu.navigation
=
Navigation
menu.
search
=
Search ...
menu.
text_search
=
Text search
menu.
find_in_file
=
Find in ...
menu.
class_search
=
Class search
menu.tools
=
Tools
menu.tools
=
Tools
menu.log
=
Log Viewer
menu.log
=
Log Viewer
menu.help
=
Help
menu.help
=
Help
...
@@ -15,7 +15,6 @@ menu.about=About
...
@@ -15,7 +15,6 @@ menu.about=About
menu.update_label
=
New version %s available!
menu.update_label
=
New version %s available!
file.open
=
Open file
file.open
=
Open file
file.save
=
Save file
file.save_all
=
Save all
file.save_all
=
Save all
file.save_all_msg
=
Select directory for save decompiled sources
file.save_all_msg
=
Select directory for save decompiled sources
file.select
=
Select
file.select
=
Select
...
...
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