Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
9ab003df
J
jadx
项目概览
keyescgm
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9ab003df
编写于
12月 21, 2019
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(gui): map back and forward mouse keys for navigation (#807)
上级
7f8d03d1
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
110 addition
and
4 deletion
+110
-4
jadx-gui/src/main/java/jadx/gui/JadxGUI.java
jadx-gui/src/main/java/jadx/gui/JadxGUI.java
+14
-1
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+40
-0
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
+6
-2
jadx-gui/src/main/java/jadx/gui/utils/JumpManager.java
jadx-gui/src/main/java/jadx/gui/utils/JumpManager.java
+30
-1
jadx-gui/src/main/java/jadx/gui/utils/SystemInfo.java
jadx-gui/src/main/java/jadx/gui/utils/SystemInfo.java
+20
-0
未找到文件。
jadx-gui/src/main/java/jadx/gui/JadxGUI.java
浏览文件 @
9ab003df
package
jadx.gui
;
import
javax.swing.*
;
import
javax.swing.SwingUtilities
;
import
javax.swing.UIManager
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -10,6 +11,7 @@ import jadx.gui.settings.JadxSettings;
import
jadx.gui.settings.JadxSettingsAdapter
;
import
jadx.gui.ui.MainWindow
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.SystemInfo
;
import
jadx.gui.utils.logs.LogCollector
;
public
class
JadxGUI
{
...
...
@@ -28,6 +30,8 @@ public class JadxGUI {
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
());
}
NLS
.
setLocale
(
settings
.
getLangLocale
());
printSystemInfo
();
SwingUtilities
.
invokeLater
(
new
MainWindow
(
settings
)::
init
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Error: {}"
,
e
.
getMessage
(),
e
);
...
...
@@ -47,4 +51,13 @@ public class JadxGUI {
}
return
false
;
}
private
static
void
printSystemInfo
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Starting jadx-gui. Version: '{}'. JVM: {} {}. OS: {} {}"
,
SystemInfo
.
JADX_VERSION
,
SystemInfo
.
JAVA_VM
,
SystemInfo
.
JAVA_VER
,
SystemInfo
.
OS_NAME
,
SystemInfo
.
OS_VERSION
);
}
}
}
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
浏览文件 @
9ab003df
package
jadx.gui.ui
;
import
java.awt.AWTEvent
;
import
java.awt.BorderLayout
;
import
java.awt.Component
;
import
java.awt.Dimension
;
...
...
@@ -7,6 +8,7 @@ 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
;
...
...
@@ -97,6 +99,7 @@ import jadx.gui.utils.FontUtils;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.Link
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.SystemInfo
;
import
jadx.gui.utils.UiUtils
;
import
static
javax
.
swing
.
KeyStroke
.
getKeyStroke
;
...
...
@@ -164,6 +167,7 @@ public class MainWindow extends JFrame {
FontUtils
.
registerBundledFonts
();
initUI
();
initMenuAndToolbar
();
registerMouseNavigationButtons
();
UiUtils
.
setWindowIcons
(
this
);
loadSettings
();
checkForUpdate
();
...
...
@@ -958,6 +962,42 @@ public class MainWindow extends JFrame {
setTitle
(
DEFAULT_TITLE
);
}
private
void
registerMouseNavigationButtons
()
{
Toolkit
toolkit
=
Toolkit
.
getDefaultToolkit
();
toolkit
.
addAWTEventListener
(
event
->
{
if
(
event
instanceof
MouseEvent
)
{
MouseEvent
mouseEvent
=
(
MouseEvent
)
event
;
if
(
mouseEvent
.
getID
()
==
MouseEvent
.
MOUSE_PRESSED
)
{
int
rawButton
=
mouseEvent
.
getButton
();
if
(
rawButton
<=
3
)
{
return
;
}
int
button
=
remapMouseButton
(
rawButton
);
switch
(
button
)
{
case
4
:
tabbedPane
.
navBack
();
break
;
case
5
:
tabbedPane
.
navForward
();
break
;
}
}
}
},
AWTEvent
.
MOUSE_EVENT_MASK
);
}
private
static
int
remapMouseButton
(
int
rawButton
)
{
if
(
SystemInfo
.
IS_LINUX
)
{
if
(
rawButton
==
6
)
{
return
4
;
}
if
(
rawButton
==
7
)
{
return
5
;
}
}
return
rawButton
;
}
private
static
String
[]
getPathExpansion
(
TreePath
path
)
{
List
<
String
>
pathList
=
new
ArrayList
<>();
while
(
path
!=
null
)
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
浏览文件 @
9ab003df
package
jadx.gui.ui
;
import
java.awt.
*
;
import
java.awt.
Component
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.swing.*
;
import
javax.swing.JTabbedPane
;
import
javax.swing.SwingUtilities
;
import
javax.swing.text.BadLocationException
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -40,6 +41,9 @@ public class TabbedPane extends JTabbedPane {
setTabLayoutPolicy
(
JTabbedPane
.
SCROLL_TAB_LAYOUT
);
addMouseWheelListener
(
e
->
{
if
(
openTabs
.
isEmpty
())
{
return
;
}
int
direction
=
e
.
getWheelRotation
();
int
index
=
getSelectedIndex
();
int
maxIndex
=
getTabCount
()
-
1
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/JumpManager.java
浏览文件 @
9ab003df
...
...
@@ -2,6 +2,9 @@ package jadx.gui.utils;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
org.jetbrains.annotations.Nullable
;
public
class
JumpManager
{
...
...
@@ -9,7 +12,7 @@ public class JumpManager {
private
int
currentPos
=
0
;
public
void
addPosition
(
JumpPosition
pos
)
{
if
(
pos
.
equals
(
getCurrent
()
))
{
if
(
ignoreJump
(
pos
))
{
return
;
}
currentPos
++;
...
...
@@ -25,6 +28,30 @@ public class JumpManager {
}
}
private
boolean
ignoreJump
(
JumpPosition
pos
)
{
JumpPosition
current
=
getCurrent
();
if
(
current
==
null
)
{
return
false
;
}
if
(
pos
.
equals
(
current
))
{
return
true
;
}
if
(
Objects
.
equals
(
current
.
getNode
(),
pos
.
getNode
()))
{
// undefined jump line in same node // TODO: find the cause
if
(
pos
.
getLine
()
==
0
)
{
return
true
;
}
if
(
current
.
getLine
()
==
0
)
{
// replace current
getPrev
();
return
false
;
}
return
false
;
}
return
false
;
}
@Nullable
private
JumpPosition
getCurrent
()
{
if
(
currentPos
>=
0
&&
currentPos
<
list
.
size
())
{
return
list
.
get
(
currentPos
);
...
...
@@ -32,6 +59,7 @@ public class JumpManager {
return
null
;
}
@Nullable
public
JumpPosition
getPrev
()
{
if
(
currentPos
==
0
)
{
return
null
;
...
...
@@ -40,6 +68,7 @@ public class JumpManager {
return
list
.
get
(
currentPos
);
}
@Nullable
public
JumpPosition
getNext
()
{
int
size
=
list
.
size
();
if
(
size
==
0
)
{
...
...
jadx-gui/src/main/java/jadx/gui/utils/SystemInfo.java
0 → 100644
浏览文件 @
9ab003df
package
jadx.gui.utils
;
import
java.util.Locale
;
import
jadx.api.JadxDecompiler
;
public
class
SystemInfo
{
public
static
final
String
JADX_VERSION
=
JadxDecompiler
.
getVersion
();
public
static
final
String
JAVA_VM
=
System
.
getProperty
(
"java.vm.name"
);
public
static
final
String
JAVA_VER
=
System
.
getProperty
(
"java.version"
);
public
static
final
String
OS_NAME
=
System
.
getProperty
(
"os.name"
);
public
static
final
String
OS_VERSION
=
System
.
getProperty
(
"os.version"
);
private
static
final
String
LOWER_OS_NAME
=
OS_NAME
.
toLowerCase
(
Locale
.
ENGLISH
);
public
static
final
boolean
IS_WINDOWS
=
LOWER_OS_NAME
.
startsWith
(
"windows"
);
public
static
final
boolean
IS_MAC
=
LOWER_OS_NAME
.
startsWith
(
"mac"
);
public
static
final
boolean
IS_LINUX
=
LOWER_OS_NAME
.
startsWith
(
"linux"
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录