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
65818dcc
Commit
65818dcc
authored
May 06, 2019
by
Jan S
Committed by
skylot
May 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(gui): save the class tree width and restore it upon jadx-gui start (PR #606)
parent
7ac0b9f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
5 deletions
+55
-5
JadxSettings.java
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
+17
-1
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+38
-4
No files found.
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
View file @
65818dcc
package
jadx
.
gui
.
settings
;
import
java.awt.*
;
import
java.awt.Font
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Window
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
...
...
@@ -55,6 +58,10 @@ public class JadxSettings extends JadxCLIArgs {
private
Map
<
String
,
WindowLocation
>
windowPos
=
new
HashMap
<>();
private
int
mainWindowExtendedState
=
JFrame
.
NORMAL
;
/**
* UI setting: the width of the tree showing the classes, resources, ...
*/
private
int
treeWidth
=
130
;
private
int
settingsVersion
=
0
;
...
...
@@ -305,6 +312,15 @@ public class JadxSettings extends JadxCLIArgs {
this
.
exportAsGradleProject
=
exportAsGradleProject
;
}
public
int
getTreeWidth
()
{
return
treeWidth
;
}
public
void
setTreeWidth
(
int
treeWidth
)
{
this
.
treeWidth
=
treeWidth
;
partialSync
(
settings
->
settings
.
treeWidth
=
JadxSettings
.
this
.
treeWidth
);
}
public
Font
getFont
()
{
if
(
fontStr
.
isEmpty
())
{
return
DEFAULT_FONT
;
...
...
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
65818dcc
package
jadx
.
gui
.
ui
;
import
java.awt.*
;
import
java.awt.BorderLayout
;
import
java.awt.Component
;
import
java.awt.Dimension
;
import
java.awt.DisplayMode
;
import
java.awt.Font
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.dnd.DnDConstants
;
import
java.awt.dnd.DropTarget
;
import
java.awt.event.ActionEvent
;
...
...
@@ -23,7 +29,27 @@ import java.util.Locale;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
javax.swing.*
;
import
javax.swing.AbstractAction
;
import
javax.swing.Action
;
import
javax.swing.Box
;
import
javax.swing.ImageIcon
;
import
javax.swing.JCheckBoxMenuItem
;
import
javax.swing.JFileChooser
;
import
javax.swing.JFrame
;
import
javax.swing.JMenu
;
import
javax.swing.JMenuBar
;
import
javax.swing.JMenuItem
;
import
javax.swing.JOptionPane
;
import
javax.swing.JPanel
;
import
javax.swing.JPopupMenu
;
import
javax.swing.JScrollPane
;
import
javax.swing.JSplitPane
;
import
javax.swing.JToggleButton
;
import
javax.swing.JToolBar
;
import
javax.swing.JTree
;
import
javax.swing.ProgressMonitor
;
import
javax.swing.SwingUtilities
;
import
javax.swing.WindowConstants
;
import
javax.swing.event.MenuEvent
;
import
javax.swing.event.MenuListener
;
import
javax.swing.event.TreeExpansionEvent
;
...
...
@@ -102,6 +128,7 @@ public class MainWindow extends JFrame {
private
transient
Action
saveProjectAction
;
private
JPanel
mainPanel
;
private
JSplitPane
splitPane
;
private
JTree
tree
;
private
DefaultTreeModel
treeModel
;
...
...
@@ -140,6 +167,7 @@ public class MainWindow extends JFrame {
public
void
init
()
{
pack
();
setLocationAndPosition
();
splitPane
.
setDividerLocation
(
settings
.
getTreeWidth
());
heapUsageBar
.
setVisible
(
settings
.
isShowHeapUsageBar
());
setVisible
(
true
);
setDefaultCloseOperation
(
WindowConstants
.
DO_NOTHING_ON_CLOSE
);
...
...
@@ -772,8 +800,9 @@ public class MainWindow extends JFrame {
}
private
void
initUI
()
{
setMinimumSize
(
new
Dimension
(
200
,
150
));
mainPanel
=
new
JPanel
(
new
BorderLayout
());
JSplitPane
splitPane
=
new
JSplitPane
();
splitPane
=
new
JSplitPane
();
splitPane
.
setResizeWeight
(
SPLIT_PANE_RESIZE_WEIGHT
);
mainPanel
.
add
(
splitPane
);
...
...
@@ -840,11 +869,15 @@ public class MainWindow extends JFrame {
progressPane
=
new
ProgressPanel
(
this
,
true
);
JPanel
leftPane
=
new
JPanel
(
new
BorderLayout
());
leftPane
.
add
(
new
JScrollPane
(
tree
),
BorderLayout
.
CENTER
);
JScrollPane
treeScrollPane
=
new
JScrollPane
(
tree
);
treeScrollPane
.
setMinimumSize
(
new
Dimension
(
100
,
150
));
leftPane
.
add
(
treeScrollPane
,
BorderLayout
.
CENTER
);
leftPane
.
add
(
progressPane
,
BorderLayout
.
PAGE_END
);
splitPane
.
setLeftComponent
(
leftPane
);
tabbedPane
=
new
TabbedPane
(
this
);
tabbedPane
.
setMinimumSize
(
new
Dimension
(
150
,
150
));
splitPane
.
setRightComponent
(
tabbedPane
);
new
DropTarget
(
this
,
DnDConstants
.
ACTION_COPY
,
new
MainDropTarget
(
this
));
...
...
@@ -931,6 +964,7 @@ public class MainWindow extends JFrame {
if
(!
ensureProjectIsSaved
())
{
return
;
}
settings
.
setTreeWidth
(
splitPane
.
getDividerLocation
());
settings
.
saveWindowPos
(
this
);
settings
.
setMainWindowExtendedState
(
getExtendedState
());
cancelBackgroundJobs
();
...
...
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