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
b4930bc4
Commit
b4930bc4
authored
Mar 19, 2016
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui: fix issues in search dialog
parent
5f302238
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
32 deletions
+54
-32
CommonSearchDialog.java
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
+29
-27
SearchDialog.java
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
+25
-5
No files found.
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
View file @
b4930bc4
...
...
@@ -53,7 +53,6 @@ import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import
org.fife.ui.rtextarea.SearchContext
;
import
org.fife.ui.rtextarea.SearchEngine
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -246,7 +245,7 @@ public abstract class CommonSearchDialog extends JDialog {
column
.
setPreferredWidth
(
colWidth
);
}
if
(
codeComp
!=
null
)
{
setRowHeight
(
codeComp
.
getPreferredSize
().
height
+
4
);
setRowHeight
(
Math
.
max
(
20
,
codeComp
.
getPreferredSize
().
height
+
4
)
);
}
updateUI
();
}
...
...
@@ -320,6 +319,8 @@ public abstract class CommonSearchDialog extends JDialog {
private
final
Color
selectedForeground
;
private
final
Color
foreground
;
private
final
JLabel
emptyLabel
=
new
JLabel
();
private
Map
<
Integer
,
Component
>
componentCache
=
new
HashMap
<
Integer
,
Component
>();
public
ResultsTableCellRenderer
()
{
...
...
@@ -332,15 +333,17 @@ public abstract class CommonSearchDialog extends JDialog {
@Override
public
Component
getTableCellRendererComponent
(
JTable
table
,
Object
obj
,
boolean
isSelected
,
boolean
hasFocus
,
int
row
,
int
column
)
{
int
id
=
(
row
<<
2
)
|
column
;
int
id
=
row
<<
2
|
column
;
Component
comp
=
componentCache
.
get
(
id
);
if
(
comp
==
null
&&
(
obj
instanceof
JNode
))
{
comp
=
makeCell
((
JNode
)
obj
,
column
);
componentCache
.
put
(
id
,
comp
);
}
if
(
comp
!=
null
)
{
updateSelection
(
comp
,
isSelected
);
if
(
comp
==
null
)
{
if
(
obj
instanceof
JNode
)
{
comp
=
makeCell
((
JNode
)
obj
,
column
);
componentCache
.
put
(
id
,
comp
);
}
else
{
comp
=
emptyLabel
;
}
}
updateSelection
(
comp
,
isSelected
);
return
comp
;
}
...
...
@@ -354,31 +357,30 @@ public abstract class CommonSearchDialog extends JDialog {
}
}
@Nullable
protected
Component
makeCell
(
JNode
node
,
int
column
)
{
private
Component
makeCell
(
JNode
node
,
int
column
)
{
if
(
column
==
0
)
{
JLabel
label
=
new
JLabel
(
node
.
makeLongString
()
+
" "
,
node
.
getIcon
(),
SwingConstants
.
LEFT
);
label
.
setOpaque
(
true
);
label
.
setToolTipText
(
label
.
getText
());
return
label
;
}
if
(
node
.
hasDescString
())
{
RSyntaxTextArea
textArea
=
new
RSyntaxTextArea
();
textArea
.
setFont
(
codeFont
);
textArea
.
setEditable
(
false
);
textArea
.
setSyntaxEditingStyle
(
SyntaxConstants
.
SYNTAX_STYLE_JAVA
);
textArea
.
setText
(
" "
+
node
.
makeDescString
());
textArea
.
setRows
(
1
);
textArea
.
setColumns
(
textArea
.
getText
().
length
());
if
(
highlightText
!=
null
)
{
SearchContext
searchContext
=
new
SearchContext
(
highlightText
);
searchContext
.
setMatchCase
(
true
);
searchContext
.
setMarkAll
(
true
);
SearchEngine
.
markAll
(
textArea
,
searchContext
);
}
return
textArea
;
if
(!
node
.
hasDescString
())
{
return
emptyLabel
;
}
return
null
;
RSyntaxTextArea
textArea
=
new
RSyntaxTextArea
();
textArea
.
setFont
(
codeFont
);
textArea
.
setEditable
(
false
);
textArea
.
setSyntaxEditingStyle
(
SyntaxConstants
.
SYNTAX_STYLE_JAVA
);
textArea
.
setText
(
" "
+
node
.
makeDescString
());
textArea
.
setRows
(
1
);
textArea
.
setColumns
(
textArea
.
getText
().
length
());
if
(
highlightText
!=
null
)
{
SearchContext
searchContext
=
new
SearchContext
(
highlightText
);
searchContext
.
setMatchCase
(
true
);
searchContext
.
setMarkAll
(
true
);
SearchEngine
.
markAll
(
textArea
,
searchContext
);
}
return
textArea
;
}
public
void
clear
()
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/SearchDialog.java
View file @
b4930bc4
package
jadx
.
gui
.
ui
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.search.TextSearchIndex
;
import
jadx.gui.utils.TextStandardActions
;
import
jadx.gui.utils.search.TextSearchIndex
;
import
javax.swing.BorderFactory
;
import
javax.swing.Box
;
...
...
@@ -12,6 +12,7 @@ import javax.swing.JLabel;
import
javax.swing.JPanel
;
import
javax.swing.JTextField
;
import
javax.swing.SwingUtilities
;
import
javax.swing.Timer
;
import
javax.swing.WindowConstants
;
import
javax.swing.event.DocumentEvent
;
import
javax.swing.event.DocumentListener
;
...
...
@@ -19,6 +20,8 @@ import java.awt.BorderLayout;
import
java.awt.Container
;
import
java.awt.Dimension
;
import
java.awt.FlowLayout
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ItemEvent
;
import
java.awt.event.ItemListener
;
import
java.awt.event.KeyAdapter
;
...
...
@@ -105,18 +108,35 @@ public class SearchDialog extends CommonSearchDialog {
highlightText
=
text
;
resultsTable
.
updateTable
();
}
private
class
SearchFieldListener
implements
DocumentListener
{
public
void
changedUpdate
(
DocumentEvent
e
)
{
private
class
SearchFieldListener
implements
DocumentListener
,
ActionListener
{
private
Timer
timer
;
private
synchronized
void
change
()
{
if
(
timer
!=
null
)
{
timer
.
restart
();
}
else
{
timer
=
new
Timer
(
300
,
this
);
timer
.
start
();
}
}
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
performSearch
();
}
public
void
changedUpdate
(
DocumentEvent
e
)
{
change
();
}
public
void
removeUpdate
(
DocumentEvent
e
)
{
performSearch
();
change
();
}
public
void
insertUpdate
(
DocumentEvent
e
)
{
performSearch
();
change
();
}
}
...
...
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