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
9e24a5ab
Commit
9e24a5ab
authored
Sep 02, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(gui): show 'copy name' action only for supported nodes
parent
b587b6d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
+27
-9
TabbedPane.java
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
+18
-5
Utils.java
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
+9
-4
No files found.
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
View file @
9e24a5ab
...
...
@@ -225,9 +225,12 @@ class TabbedPane extends JTabbedPane {
private
JPopupMenu
createTabPopupMenu
(
final
ContentPanel
contentPanel
)
{
JPopupMenu
menu
=
new
JPopupMenu
();
JMenuItem
copyRootClassName
=
new
JMenuItem
(
NLS
.
str
(
"tabs.copy_class_name"
));
copyRootClassName
.
addActionListener
(
actionEvent
->
copyRootClassName
());
menu
.
add
(
copyRootClassName
);
if
(
getNodeFullName
()
!=
null
)
{
JMenuItem
copyRootClassName
=
new
JMenuItem
(
NLS
.
str
(
"tabs.copy_class_name"
));
copyRootClassName
.
addActionListener
(
actionEvent
->
copyRootClassName
());
menu
.
add
(
copyRootClassName
);
menu
.
addSeparator
();
}
JMenuItem
closeTab
=
new
JMenuItem
(
NLS
.
str
(
"tabs.close"
));
closeTab
.
addActionListener
(
e
->
closeCodePanel
(
contentPanel
));
...
...
@@ -275,15 +278,25 @@ class TabbedPane extends JTabbedPane {
}
public
void
copyRootClassName
()
{
String
name
=
getNodeFullName
();
if
(
name
!=
null
)
{
Utils
.
setClipboardString
(
name
);
}
}
@Nullable
private
String
getNodeFullName
()
{
ContentPanel
selectedPanel
=
getSelectedCodePanel
();
if
(
selectedPanel
!=
null
)
{
JNode
node
=
selectedPanel
.
getNode
();
JClass
jClass
=
node
.
getRootClass
();
if
(
jClass
!=
null
)
{
String
name
=
jClass
.
getFullName
();
Utils
.
setClipboardString
(
name
);
return
jClass
.
getFullName
();
}
else
{
return
node
.
getName
();
}
}
return
null
;
}
public
void
loadSettings
()
{
...
...
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
View file @
9e24a5ab
...
...
@@ -141,9 +141,14 @@ public class Utils {
return
toLower
?
Character
.
toLowerCase
(
ch
)
:
ch
;
}
public
static
void
setClipboardString
(
String
text
){
Clipboard
clipboard
=
Toolkit
.
getDefaultToolkit
().
getSystemClipboard
();
Transferable
transferable
=
new
StringSelection
(
text
);
clipboard
.
setContents
(
transferable
,
null
);
public
static
void
setClipboardString
(
String
text
)
{
try
{
Clipboard
clipboard
=
Toolkit
.
getDefaultToolkit
().
getSystemClipboard
();
Transferable
transferable
=
new
StringSelection
(
text
);
clipboard
.
setContents
(
transferable
,
null
);
LOG
.
debug
(
"String '{}' copied to clipboard"
,
text
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Failed copy string '{}' to clipboard"
,
text
,
e
);
}
}
}
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