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
cfbbd99b
Commit
cfbbd99b
authored
Apr 21, 2019
by
sergey-wowwow
Committed by
skylot
Apr 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(gui): use command (CMD) button for MacOS (#165) (PR #616)
parent
c74b7f20
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+13
-11
CodePanel.java
jadx-gui/src/main/java/jadx/gui/ui/codearea/CodePanel.java
+1
-1
TextStandardActions.java
...gui/src/main/java/jadx/gui/utils/TextStandardActions.java
+2
-2
Utils.java
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
+10
-0
No files found.
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
cfbbd99b
...
...
@@ -8,10 +8,12 @@ import java.awt.DisplayMode;
import
java.awt.Font
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Toolkit
;
import
java.awt.dnd.DnDConstants
;
import
java.awt.dnd.DropTarget
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.InputEvent
;
import
java.awt.event.KeyAdapter
;
import
java.awt.event.KeyEvent
;
import
java.awt.event.MouseAdapter
;
...
...
@@ -560,7 +562,7 @@ public class MainWindow extends JFrame {
}
};
openAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"file.open_action"
));
openAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_O
,
KeyEvent
.
CTRL_DOWN_MASK
));
openAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_O
,
Utils
.
ctrlButton
()
));
newProjectAction
=
new
AbstractAction
(
NLS
.
str
(
"file.new_project"
))
{
@Override
...
...
@@ -593,7 +595,7 @@ public class MainWindow extends JFrame {
}
};
saveAllAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"file.save_all"
));
saveAllAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_S
,
KeyEvent
.
CTRL_DOWN_MASK
));
saveAllAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_S
,
Utils
.
ctrlButton
()
));
Action
exportAction
=
new
AbstractAction
(
NLS
.
str
(
"file.export_gradle"
),
ICON_EXPORT
)
{
@Override
...
...
@@ -602,7 +604,7 @@ public class MainWindow extends JFrame {
}
};
exportAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"file.export_gradle"
));
exportAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_E
,
KeyEvent
.
CTRL_DOWN_MASK
));
exportAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_E
,
Utils
.
ctrlButton
()
));
JMenu
recentProjects
=
new
JMenu
(
NLS
.
str
(
"menu.recent_projects"
));
recentProjects
.
addMenuListener
(
new
RecentProjectsMenuListener
(
recentProjects
));
...
...
@@ -615,7 +617,7 @@ public class MainWindow extends JFrame {
};
prefsAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"menu.preferences"
));
prefsAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_P
,
KeyEvent
.
CTRL_DOWN_MASK
|
KeyEvent
.
SHIFT_DOWN_MASK
));
Utils
.
ctrlButton
()
|
KeyEvent
.
SHIFT_DOWN_MASK
));
Action
exitAction
=
new
AbstractAction
(
NLS
.
str
(
"file.exit"
),
ICON_CLOSE
)
{
@Override
...
...
@@ -642,7 +644,7 @@ public class MainWindow extends JFrame {
}
};
syncAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"menu.sync"
));
syncAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_T
,
KeyEvent
.
CTRL_DOWN_MASK
));
syncAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_T
,
Utils
.
ctrlButton
()
));
Action
textSearchAction
=
new
AbstractAction
(
NLS
.
str
(
"menu.text_search"
),
ICON_SEARCH
)
{
@Override
...
...
@@ -652,7 +654,7 @@ public class MainWindow extends JFrame {
};
textSearchAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"menu.text_search"
));
textSearchAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_F
,
KeyEvent
.
CTRL_DOWN_MASK
|
KeyEvent
.
SHIFT_DOWN_MASK
));
getKeyStroke
(
KeyEvent
.
VK_F
,
Utils
.
ctrlButton
()
|
KeyEvent
.
SHIFT_DOWN_MASK
));
Action
clsSearchAction
=
new
AbstractAction
(
NLS
.
str
(
"menu.class_search"
),
ICON_FIND
)
{
@Override
...
...
@@ -661,7 +663,7 @@ public class MainWindow extends JFrame {
}
};
clsSearchAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"menu.class_search"
));
clsSearchAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_N
,
KeyEvent
.
CTRL_DOWN_MASK
));
clsSearchAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_N
,
Utils
.
ctrlButton
()
));
Action
deobfAction
=
new
AbstractAction
(
NLS
.
str
(
"menu.deobfuscation"
),
ICON_DEOBF
)
{
@Override
...
...
@@ -671,7 +673,7 @@ public class MainWindow extends JFrame {
};
deobfAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"preferences.deobfuscation"
));
deobfAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_D
,
KeyEvent
.
CTRL_DOWN_MASK
|
KeyEvent
.
ALT_DOWN_MASK
));
getKeyStroke
(
KeyEvent
.
VK_D
,
Utils
.
ctrlButton
()
|
KeyEvent
.
ALT_DOWN_MASK
));
deobfToggleBtn
=
new
JToggleButton
(
deobfAction
);
deobfToggleBtn
.
setSelected
(
settings
.
isDeobfuscationOn
());
...
...
@@ -688,7 +690,7 @@ public class MainWindow extends JFrame {
};
logAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"menu.log"
));
logAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_L
,
KeyEvent
.
CTRL_DOWN_MASK
|
KeyEvent
.
SHIFT_DOWN_MASK
));
Utils
.
ctrlButton
()
|
KeyEvent
.
SHIFT_DOWN_MASK
));
Action
aboutAction
=
new
AbstractAction
(
NLS
.
str
(
"menu.about"
),
ICON_JADX
)
{
@Override
...
...
@@ -705,7 +707,7 @@ public class MainWindow extends JFrame {
};
backAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"nav.back"
));
backAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_LEFT
,
KeyEvent
.
CTRL_DOWN_MASK
|
KeyEvent
.
ALT_DOWN_MASK
));
Utils
.
ctrlButton
()
|
KeyEvent
.
ALT_DOWN_MASK
));
Action
forwardAction
=
new
AbstractAction
(
NLS
.
str
(
"nav.forward"
),
ICON_FORWARD
)
{
@Override
...
...
@@ -715,7 +717,7 @@ public class MainWindow extends JFrame {
};
forwardAction
.
putValue
(
Action
.
SHORT_DESCRIPTION
,
NLS
.
str
(
"nav.forward"
));
forwardAction
.
putValue
(
Action
.
ACCELERATOR_KEY
,
getKeyStroke
(
KeyEvent
.
VK_RIGHT
,
KeyEvent
.
CTRL_DOWN_MASK
|
KeyEvent
.
ALT_DOWN_MASK
));
Utils
.
ctrlButton
()
|
KeyEvent
.
ALT_DOWN_MASK
));
JMenu
file
=
new
JMenu
(
NLS
.
str
(
"menu.file"
));
file
.
setMnemonic
(
KeyEvent
.
VK_F
);
...
...
jadx-gui/src/main/java/jadx/gui/ui/codearea/CodePanel.java
View file @
cfbbd99b
...
...
@@ -32,7 +32,7 @@ public final class CodePanel extends ContentPanel {
add
(
searchBar
,
BorderLayout
.
NORTH
);
add
(
scrollPane
);
KeyStroke
key
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_F
,
InputEvent
.
CTRL_DOWN_MASK
);
KeyStroke
key
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_F
,
Utils
.
ctrlButton
()
);
Utils
.
addKeyBinding
(
codeArea
,
key
,
"SearchAction"
,
new
SearchAction
());
}
...
...
jadx-gui/src/main/java/jadx/gui/utils/TextStandardActions.java
View file @
cfbbd99b
...
...
@@ -100,9 +100,9 @@ public class TextStandardActions {
}
private
void
addKeyActions
()
{
KeyStroke
undoKey
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_Z
,
InputEvent
.
CTRL_DOWN_MASK
);
KeyStroke
undoKey
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_Z
,
Utils
.
ctrlButton
()
);
textComponent
.
getInputMap
().
put
(
undoKey
,
undoAction
);
KeyStroke
redoKey
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_R
,
InputEvent
.
CTRL_DOWN_MASK
);
KeyStroke
redoKey
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_R
,
Utils
.
ctrlButton
()
);
textComponent
.
getInputMap
().
put
(
redoKey
,
redoAction
);
}
...
...
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
View file @
cfbbd99b
...
...
@@ -5,6 +5,7 @@ import java.awt.*;
import
java.awt.datatransfer.Clipboard
;
import
java.awt.datatransfer.StringSelection
;
import
java.awt.datatransfer.Transferable
;
import
java.awt.event.InputEvent
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.ArrayList
;
...
...
@@ -202,4 +203,13 @@ public class Utils {
icons
.
add
(
Utils
.
openImage
(
"/logos/jadx-logo.png"
));
window
.
setIconImages
(
icons
);
}
public
static
int
ctrlButton
()
{
if
(
System
.
getProperty
(
"os.name"
).
toLowerCase
().
contains
(
"mac"
))
{
return
Toolkit
.
getDefaultToolkit
().
getMenuShortcutKeyMask
();
}
else
{
return
InputEvent
.
CTRL_DOWN_MASK
;
}
}
}
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