From 1a9cb832ab8fe0ef291d525bfb5730031f282138 Mon Sep 17 00:00:00 2001 From: Skylot Date: Wed, 26 Oct 2022 19:58:58 +0100 Subject: [PATCH] feat(gui): add alternative file open dialog (#1709) --- .../java/jadx/gui/settings/JadxSettings.java | 9 + .../jadx/gui/settings/JadxSettingsWindow.java | 5 + .../src/main/java/jadx/gui/ui/MainWindow.java | 19 +- .../java/jadx/gui/ui/dialog/FileDialog.java | 202 ------------------ .../gui/ui/filedialog/CustomFileChooser.java | 97 +++++++++ .../gui/ui/filedialog/CustomFileDialog.java | 47 ++++ .../gui/ui/filedialog/FileDialogWrapper.java | 138 ++++++++++++ .../jadx/gui/ui/filedialog/FileOpenMode.java | 11 + .../resources/i18n/Messages_de_DE.properties | 1 + .../resources/i18n/Messages_en_US.properties | 1 + .../resources/i18n/Messages_es_ES.properties | 1 + .../resources/i18n/Messages_ko_KR.properties | 1 + .../resources/i18n/Messages_pt_BR.properties | 1 + .../resources/i18n/Messages_zh_CN.properties | 1 + .../resources/i18n/Messages_zh_TW.properties | 1 + 15 files changed, 324 insertions(+), 211 deletions(-) delete mode 100644 jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java create mode 100644 jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileChooser.java create mode 100644 jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileDialog.java create mode 100644 jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileDialogWrapper.java create mode 100644 jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileOpenMode.java diff --git a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java index b60ac3b6315..9876e2d2d69 100644 --- a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java +++ b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java @@ -73,6 +73,7 @@ public class JadxSettings extends JadxCLIArgs { private boolean showHeapUsageBar = false; private boolean alwaysSelectOpened = false; + private boolean useAlternativeFileDialog = false; private Map windowPos = new HashMap<>(); private int mainWindowExtendedState = JFrame.NORMAL; @@ -268,6 +269,14 @@ public void setAlwaysSelectOpened(boolean alwaysSelectOpened) { partialSync(settings -> settings.alwaysSelectOpened = alwaysSelectOpened); } + public boolean isUseAlternativeFileDialog() { + return useAlternativeFileDialog; + } + + public void setUseAlternativeFileDialog(boolean useAlternativeFileDialog) { + this.useAlternativeFileDialog = useAlternativeFileDialog; + } + public String getExcludedPackages() { return excludedPackages; } diff --git a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java index 95438addd3b..c1702ecd604 100644 --- a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java +++ b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java @@ -643,6 +643,10 @@ private SettingsGroup makeOtherGroup() { jumpOnDoubleClick.setSelected(settings.isJumpOnDoubleClick()); jumpOnDoubleClick.addItemListener(e -> settings.setJumpOnDoubleClick(e.getStateChange() == ItemEvent.SELECTED)); + JCheckBox useAltFileDialog = new JCheckBox(); + useAltFileDialog.setSelected(settings.isUseAlternativeFileDialog()); + useAltFileDialog.addItemListener(e -> settings.setUseAlternativeFileDialog(e.getStateChange() == ItemEvent.SELECTED)); + JCheckBox update = new JCheckBox(); update.setSelected(settings.isCheckForUpdates()); update.addItemListener(e -> settings.setCheckForUpdates(e.getStateChange() == ItemEvent.SELECTED)); @@ -665,6 +669,7 @@ private SettingsGroup makeOtherGroup() { group.addRow(NLS.str("preferences.language"), languageCbx); group.addRow(NLS.str("preferences.lineNumbersMode"), lineNumbersMode); group.addRow(NLS.str("preferences.jumpOnDoubleClick"), jumpOnDoubleClick); + group.addRow(NLS.str("preferences.useAlternativeFileDialog"), useAltFileDialog); group.addRow(NLS.str("preferences.check_for_updates"), update); group.addRow(NLS.str("preferences.cfg"), cfg); group.addRow(NLS.str("preferences.raw_cfg"), rawCfg); diff --git a/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java b/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java index d2e17e7c81a..f19bf04f911 100644 --- a/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java +++ b/jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java @@ -116,10 +116,11 @@ import jadx.gui.ui.codearea.EditorViewState; import jadx.gui.ui.dialog.ADBDialog; import jadx.gui.ui.dialog.AboutDialog; -import jadx.gui.ui.dialog.FileDialog; import jadx.gui.ui.dialog.LogViewerDialog; import jadx.gui.ui.dialog.RenameDialog; import jadx.gui.ui.dialog.SearchDialog; +import jadx.gui.ui.filedialog.FileDialogWrapper; +import jadx.gui.ui.filedialog.FileOpenMode; import jadx.gui.ui.panel.ContentPanel; import jadx.gui.ui.panel.IssuesPanel; import jadx.gui.ui.panel.JDebuggerPanel; @@ -293,19 +294,19 @@ public void onUpdate(Release r) { } public void openFileDialog() { - showOpenDialog(FileDialog.OpenMode.OPEN); + showOpenDialog(FileOpenMode.OPEN); } public void openProjectDialog() { - showOpenDialog(FileDialog.OpenMode.OPEN_PROJECT); + showOpenDialog(FileOpenMode.OPEN_PROJECT); } - private void showOpenDialog(FileDialog.OpenMode mode) { + private void showOpenDialog(FileOpenMode mode) { saveAll(); if (!ensureProjectIsSaved()) { return; } - FileDialog fileDialog = new FileDialog(this, mode); + FileDialogWrapper fileDialog = new FileDialogWrapper(this, mode); List openPaths = fileDialog.show(); if (!openPaths.isEmpty()) { settings.setLastOpenFilePath(fileDialog.getCurrentDir()); @@ -314,7 +315,7 @@ private void showOpenDialog(FileDialog.OpenMode mode) { } public void addFiles() { - FileDialog fileDialog = new FileDialog(this, FileDialog.OpenMode.ADD); + FileDialogWrapper fileDialog = new FileDialogWrapper(this, FileOpenMode.ADD); List addPaths = fileDialog.show(); if (!addPaths.isEmpty()) { addFiles(addPaths); @@ -346,7 +347,7 @@ private void saveProject() { } private void saveProjectAs() { - FileDialog fileDialog = new FileDialog(this, FileDialog.OpenMode.SAVE_PROJECT); + FileDialogWrapper fileDialog = new FileDialogWrapper(this, FileOpenMode.SAVE_PROJECT); if (project.getFilePaths().size() == 1) { // If there is only one file loaded we suggest saving the jadx project file next to the loaded file Path projectPath = getProjectPathForFile(this.project.getFilePaths().get(0)); @@ -377,7 +378,7 @@ private void saveProjectAs() { } private void exportMappings(MappingFormat mappingFormat) { - FileDialog fileDialog = new FileDialog(this, FileDialog.OpenMode.CUSTOM_SAVE); + FileDialogWrapper fileDialog = new FileDialogWrapper(this, FileOpenMode.CUSTOM_SAVE); fileDialog.setTitle(NLS.str("file.export_mappings_as")); Path workingDir = project.getWorkingDir(); Path baseDir = workingDir != null ? workingDir : settings.getLastSaveFilePath(); @@ -659,7 +660,7 @@ public void cancelBackgroundJobs() { } private void saveAll(boolean export) { - FileDialog fileDialog = new FileDialog(this, FileDialog.OpenMode.EXPORT); + FileDialogWrapper fileDialog = new FileDialogWrapper(this, FileOpenMode.EXPORT); List saveDirs = fileDialog.show(); if (saveDirs.isEmpty()) { return; diff --git a/jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java b/jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java deleted file mode 100644 index 425ac2c0510..00000000000 --- a/jadx-gui/src/main/java/jadx/gui/ui/dialog/FileDialog.java +++ /dev/null @@ -1,202 +0,0 @@ -package jadx.gui.ui.dialog; - -import java.awt.Component; -import java.awt.HeadlessException; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileNameExtensionFilter; - -import org.jetbrains.annotations.Nullable; - -import jadx.api.plugins.utils.CommonFileUtils; -import jadx.core.utils.Utils; -import jadx.core.utils.files.FileUtils; -import jadx.gui.settings.JadxProject; -import jadx.gui.ui.MainWindow; -import jadx.gui.utils.NLS; - -public class FileDialog { - - public enum OpenMode { - OPEN, - OPEN_PROJECT, - ADD, - SAVE_PROJECT, - EXPORT, - CUSTOM_SAVE, - CUSTOM_OPEN - } - - private final MainWindow mainWindow; - - private boolean isOpen; - private String title; - private List fileExtList; - private int selectionMode = JFileChooser.FILES_AND_DIRECTORIES; - private @Nullable Path currentDir; - private @Nullable Path selectedFile; - - public FileDialog(MainWindow mainWindow, OpenMode mode) { - this.mainWindow = mainWindow; - initForMode(mode); - } - - public void setTitle(String title) { - this.title = title; - } - - public void setFileExtList(List fileExtList) { - this.fileExtList = fileExtList; - } - - public void setSelectionMode(int selectionMode) { - this.selectionMode = selectionMode; - } - - public void setSelectedFile(Path path) { - this.selectedFile = path; - } - - public void setCurrentDir(Path currentDir) { - this.currentDir = currentDir; - } - - public List show() { - FileChooser fileChooser = buildFileChooser(); - int ret = isOpen ? fileChooser.showOpenDialog(mainWindow) : fileChooser.showSaveDialog(mainWindow); - if (ret != JFileChooser.APPROVE_OPTION) { - return Collections.emptyList(); - } - currentDir = fileChooser.getCurrentDirectory().toPath(); - File[] selectedFiles = fileChooser.getSelectedFiles(); - if (selectedFiles.length != 0) { - return FileUtils.toPaths(selectedFiles); - } - File chosenFile = fileChooser.getSelectedFile(); - if (chosenFile != null) { - return Collections.singletonList(chosenFile.toPath()); - } - return Collections.emptyList(); - } - - public Path getCurrentDir() { - return currentDir; - } - - private void initForMode(OpenMode mode) { - switch (mode) { - case OPEN: - case OPEN_PROJECT: - case ADD: - if (mode == OpenMode.OPEN_PROJECT) { - fileExtList = Collections.singletonList(JadxProject.PROJECT_EXTENSION); - title = NLS.str("file.open_title"); - } else { - fileExtList = new ArrayList<>(Arrays.asList("apk", "dex", "jar", "class", "smali", "zip", "xapk", "aar", "arsc")); - if (mode == OpenMode.OPEN) { - fileExtList.addAll(Arrays.asList(JadxProject.PROJECT_EXTENSION, "aab")); - title = NLS.str("file.open_title"); - } else { - title = NLS.str("file.add_files_action"); - } - } - selectionMode = JFileChooser.FILES_AND_DIRECTORIES; - currentDir = mainWindow.getSettings().getLastOpenFilePath(); - isOpen = true; - break; - - case SAVE_PROJECT: - title = NLS.str("file.save_project"); - fileExtList = Collections.singletonList(JadxProject.PROJECT_EXTENSION); - selectionMode = JFileChooser.FILES_ONLY; - currentDir = mainWindow.getSettings().getLastSaveFilePath(); - isOpen = false; - break; - - case EXPORT: - title = NLS.str("file.save_all_msg"); - fileExtList = Collections.emptyList(); - selectionMode = JFileChooser.DIRECTORIES_ONLY; - currentDir = mainWindow.getSettings().getLastSaveFilePath(); - isOpen = false; - break; - - case CUSTOM_SAVE: - isOpen = false; - break; - - case CUSTOM_OPEN: - isOpen = true; - break; - } - } - - private FileChooser buildFileChooser() { - FileChooser fileChooser = new FileChooser(currentDir); - fileChooser.setToolTipText(title); - fileChooser.setFileSelectionMode(selectionMode); - fileChooser.setMultiSelectionEnabled(isOpen); - fileChooser.setAcceptAllFileFilterUsed(true); - if (Utils.notEmpty(fileExtList)) { - String description = NLS.str("file_dialog.supported_files") + ": (" + Utils.listToString(fileExtList) + ')'; - fileChooser.setFileFilter(new FileNameExtensionFilter(description, fileExtList.toArray(new String[0]))); - } - if (selectedFile != null) { - fileChooser.setSelectedFile(selectedFile.toFile()); - } - return fileChooser; - } - - private class FileChooser extends JFileChooser { - - public FileChooser(@Nullable Path currentDirectory) { - super(currentDirectory == null ? CommonFileUtils.CWD : currentDirectory.toFile()); - } - - @Override - protected JDialog createDialog(Component parent) throws HeadlessException { - JDialog dialog = super.createDialog(parent); - dialog.setTitle(title); - dialog.setLocationRelativeTo(null); - mainWindow.getSettings().loadWindowPos(dialog); - dialog.addWindowListener(new WindowAdapter() { - @Override - public void windowClosed(WindowEvent e) { - mainWindow.getSettings().saveWindowPos(dialog); - super.windowClosed(e); - } - }); - return dialog; - } - - @Override - public void approveSelection() { - if (selectionMode == FILES_AND_DIRECTORIES) { - File currentFile = getSelectedFile(); - if (currentFile.isDirectory()) { - int option = JOptionPane.showConfirmDialog( - mainWindow, - NLS.str("file_dialog.load_dir_confirm") + "\n " + currentFile, - NLS.str("file_dialog.load_dir_title"), - JOptionPane.YES_NO_OPTION); - if (option != JOptionPane.YES_OPTION) { - this.setCurrentDirectory(currentFile); - this.updateUI(); - return; - } - } - } - super.approveSelection(); - } - } -} diff --git a/jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileChooser.java b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileChooser.java new file mode 100644 index 00000000000..3cddf2938be --- /dev/null +++ b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileChooser.java @@ -0,0 +1,97 @@ +package jadx.gui.ui.filedialog; + +import java.awt.Component; +import java.awt.HeadlessException; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; + +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.filechooser.FileNameExtensionFilter; + +import jadx.api.plugins.utils.CommonFileUtils; +import jadx.core.utils.Utils; +import jadx.core.utils.files.FileUtils; +import jadx.gui.ui.MainWindow; +import jadx.gui.utils.NLS; + +class CustomFileChooser extends JFileChooser { + + private final FileDialogWrapper data; + + public CustomFileChooser(FileDialogWrapper data) { + super(data.getCurrentDir() == null ? CommonFileUtils.CWD : data.getCurrentDir().toFile()); + this.data = data; + } + + public List showDialog() { + setToolTipText(data.getTitle()); + setFileSelectionMode(data.getSelectionMode()); + setMultiSelectionEnabled(data.isOpen()); + setAcceptAllFileFilterUsed(true); + List fileExtList = data.getFileExtList(); + if (Utils.notEmpty(fileExtList)) { + String description = NLS.str("file_dialog.supported_files") + ": (" + Utils.listToString(fileExtList) + ')'; + setFileFilter(new FileNameExtensionFilter(description, fileExtList.toArray(new String[0]))); + } + if (data.getSelectedFile() != null) { + setSelectedFile(data.getSelectedFile().toFile()); + } + MainWindow mainWindow = data.getMainWindow(); + int ret = data.isOpen() ? showOpenDialog(mainWindow) : showSaveDialog(mainWindow); + if (ret != JFileChooser.APPROVE_OPTION) { + return Collections.emptyList(); + } + data.setCurrentDir(getCurrentDirectory().toPath()); + File[] selectedFiles = getSelectedFiles(); + if (selectedFiles.length != 0) { + return FileUtils.toPaths(selectedFiles); + } + File chosenFile = getSelectedFile(); + if (chosenFile != null) { + return Collections.singletonList(chosenFile.toPath()); + } + return Collections.emptyList(); + } + + @Override + protected JDialog createDialog(Component parent) throws HeadlessException { + JDialog dialog = super.createDialog(parent); + dialog.setTitle(data.getTitle()); + dialog.setLocationRelativeTo(null); + data.getMainWindow().getSettings().loadWindowPos(dialog); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosed(WindowEvent e) { + data.getMainWindow().getSettings().saveWindowPos(dialog); + super.windowClosed(e); + } + }); + return dialog; + } + + @Override + public void approveSelection() { + if (data.getSelectionMode() == FILES_AND_DIRECTORIES) { + File currentFile = getSelectedFile(); + if (currentFile.isDirectory()) { + int option = JOptionPane.showConfirmDialog( + data.getMainWindow(), + NLS.str("file_dialog.load_dir_confirm") + "\n " + currentFile, + NLS.str("file_dialog.load_dir_title"), + JOptionPane.YES_NO_OPTION); + if (option != JOptionPane.YES_OPTION) { + this.setCurrentDirectory(currentFile); + this.updateUI(); + return; + } + } + } + super.approveSelection(); + } +} diff --git a/jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileDialog.java b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileDialog.java new file mode 100644 index 00000000000..e830e64173a --- /dev/null +++ b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/CustomFileDialog.java @@ -0,0 +1,47 @@ +package jadx.gui.ui.filedialog; + +import java.awt.FileDialog; +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.List; + +import jadx.core.utils.ListUtils; +import jadx.core.utils.Utils; +import jadx.core.utils.files.FileUtils; + +class CustomFileDialog { + + private final FileDialogWrapper data; + + public CustomFileDialog(FileDialogWrapper data) { + this.data = data; + } + + public List showDialog() { + FileDialog fileDialog = new FileDialog(data.getMainWindow(), data.getTitle()); + fileDialog.setMode(data.isOpen() ? FileDialog.LOAD : FileDialog.SAVE); + fileDialog.setMultipleMode(true); + List fileExtList = data.getFileExtList(); + if (Utils.notEmpty(fileExtList)) { + fileDialog.setFilenameFilter((dir, name) -> ListUtils.anyMatch(fileExtList, name::endsWith)); + } + if (data.getSelectedFile() != null) { + fileDialog.setFile(data.getSelectedFile().toAbsolutePath().toString()); + } + if (data.getCurrentDir() != null) { + fileDialog.setDirectory(data.getCurrentDir().toAbsolutePath().toString()); + } + fileDialog.setVisible(true); + File[] selectedFiles = fileDialog.getFiles(); + if (!Utils.isEmpty(selectedFiles)) { + data.setCurrentDir(Paths.get(fileDialog.getDirectory())); + return FileUtils.toPaths(selectedFiles); + } + if (fileDialog.getFile() != null) { + return Collections.singletonList(Paths.get(fileDialog.getFile())); + } + return Collections.emptyList(); + } +} diff --git a/jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileDialogWrapper.java b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileDialogWrapper.java new file mode 100644 index 00000000000..407659de301 --- /dev/null +++ b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileDialogWrapper.java @@ -0,0 +1,138 @@ +package jadx.gui.ui.filedialog; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import javax.swing.JFileChooser; + +import org.jetbrains.annotations.Nullable; + +import jadx.gui.settings.JadxProject; +import jadx.gui.ui.MainWindow; +import jadx.gui.utils.NLS; + +public class FileDialogWrapper { + + private final MainWindow mainWindow; + + private boolean isOpen; + private String title; + private List fileExtList; + private int selectionMode = JFileChooser.FILES_AND_DIRECTORIES; + private @Nullable Path currentDir; + private @Nullable Path selectedFile; + + public FileDialogWrapper(MainWindow mainWindow, FileOpenMode mode) { + this.mainWindow = mainWindow; + initForMode(mode); + } + + public void setTitle(String title) { + this.title = title; + } + + public void setFileExtList(List fileExtList) { + this.fileExtList = fileExtList; + } + + public void setSelectionMode(int selectionMode) { + this.selectionMode = selectionMode; + } + + public void setSelectedFile(Path path) { + this.selectedFile = path; + } + + public void setCurrentDir(Path currentDir) { + this.currentDir = currentDir; + } + + public List show() { + if (mainWindow.getSettings().isUseAlternativeFileDialog()) { + return new CustomFileDialog(this).showDialog(); + } else { + return new CustomFileChooser(this).showDialog(); + } + } + + private void initForMode(FileOpenMode mode) { + switch (mode) { + case OPEN: + case OPEN_PROJECT: + case ADD: + if (mode == FileOpenMode.OPEN_PROJECT) { + fileExtList = Collections.singletonList(JadxProject.PROJECT_EXTENSION); + title = NLS.str("file.open_title"); + } else { + fileExtList = new ArrayList<>(Arrays.asList("apk", "dex", "jar", "class", "smali", "zip", "xapk", "aar", "arsc")); + if (mode == FileOpenMode.OPEN) { + fileExtList.addAll(Arrays.asList(JadxProject.PROJECT_EXTENSION, "aab")); + title = NLS.str("file.open_title"); + } else { + title = NLS.str("file.add_files_action"); + } + } + selectionMode = JFileChooser.FILES_AND_DIRECTORIES; + currentDir = mainWindow.getSettings().getLastOpenFilePath(); + isOpen = true; + break; + + case SAVE_PROJECT: + title = NLS.str("file.save_project"); + fileExtList = Collections.singletonList(JadxProject.PROJECT_EXTENSION); + selectionMode = JFileChooser.FILES_ONLY; + currentDir = mainWindow.getSettings().getLastSaveFilePath(); + isOpen = false; + break; + + case EXPORT: + title = NLS.str("file.save_all_msg"); + fileExtList = Collections.emptyList(); + selectionMode = JFileChooser.DIRECTORIES_ONLY; + currentDir = mainWindow.getSettings().getLastSaveFilePath(); + isOpen = false; + break; + + case CUSTOM_SAVE: + isOpen = false; + currentDir = mainWindow.getSettings().getLastSaveFilePath(); + break; + + case CUSTOM_OPEN: + isOpen = true; + currentDir = mainWindow.getSettings().getLastOpenFilePath(); + break; + } + } + + public Path getCurrentDir() { + return currentDir; + } + + public MainWindow getMainWindow() { + return mainWindow; + } + + public boolean isOpen() { + return isOpen; + } + + public String getTitle() { + return title; + } + + public List getFileExtList() { + return fileExtList; + } + + public int getSelectionMode() { + return selectionMode; + } + + public Path getSelectedFile() { + return selectedFile; + } +} diff --git a/jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileOpenMode.java b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileOpenMode.java new file mode 100644 index 00000000000..6043210337c --- /dev/null +++ b/jadx-gui/src/main/java/jadx/gui/ui/filedialog/FileOpenMode.java @@ -0,0 +1,11 @@ +package jadx.gui.ui.filedialog; + +public enum FileOpenMode { + OPEN, + OPEN_PROJECT, + ADD, + SAVE_PROJECT, + EXPORT, + CUSTOM_SAVE, + CUSTOM_OPEN +} diff --git a/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties b/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties index 55a2ec6b899..9800ca4fab5 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_de_DE.properties @@ -144,6 +144,7 @@ preferences.other=Andere preferences.language=Sprache preferences.lineNumbersMode=Editor Zeilennummern-Modus preferences.jumpOnDoubleClick=Sprung bei Doppelklick aktivieren +#preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=Nach Updates beim Start suchen preferences.useDx=dx/d8 zur Konvertierung von Java Bytecode verwenden preferences.decompilationMode=Dekompilierungsmodus diff --git a/jadx-gui/src/main/resources/i18n/Messages_en_US.properties b/jadx-gui/src/main/resources/i18n/Messages_en_US.properties index f03d1c2e8ea..babdb80fc5d 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_en_US.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_en_US.properties @@ -144,6 +144,7 @@ preferences.other=Other preferences.language=Language preferences.lineNumbersMode=Editor line numbers mode preferences.jumpOnDoubleClick=Enable jump on double click +preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=Check for updates on startup preferences.useDx=Use dx/d8 to convert java bytecode preferences.decompilationMode=Decompilation mode diff --git a/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties b/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties index b53100add66..3772a46163f 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_es_ES.properties @@ -144,6 +144,7 @@ preferences.other=Otros preferences.language=Idioma #preferences.lineNumbersMode=Editor line numbers mode #preferences.jumpOnDoubleClick=Enable jump on double click +#preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=Buscar actualizaciones al iniciar #preferences.useDx=Use dx/d8 to convert java bytecode #preferences.decompilationMode=Decompilation mode diff --git a/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties b/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties index 103f95ad365..2fee02a4355 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties @@ -144,6 +144,7 @@ preferences.other=기타 preferences.language=언어 preferences.lineNumbersMode=편집기 줄 번호 모드 preferences.jumpOnDoubleClick=더블 클릭 시 점프 활성화 +#preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=시작시 업데이트 확인 preferences.useDx=dx/d8을 사용하여 Java 바이트 코드 변환 preferences.decompilationMode=디컴파일 모드 diff --git a/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties b/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties index 6318f44a727..4d9301ba045 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties @@ -144,6 +144,7 @@ preferences.other=Outro preferences.language=Idioma preferences.lineNumbersMode=Modo do contador de linhas do editor preferences.jumpOnDoubleClick=Ativar salto no duplo clique +#preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=Verificar por atualizações ao inicializar preferences.useDx=Usar dx/d8 para converter bytecode Java preferences.decompilationMode=Modo de descompilação diff --git a/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties b/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties index f469eb4a9ac..71a16b8160f 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties @@ -144,6 +144,7 @@ preferences.other=其他 preferences.language=语言 preferences.lineNumbersMode=编辑器行号模式 preferences.jumpOnDoubleClick=启用双击跳转 +#preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=启动时检查更新 preferences.useDx=使用 dx/d8 来转换java字节码 preferences.decompilationMode=反编译模式 diff --git a/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties b/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties index 60eae5a2365..ca81942a7f1 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties @@ -144,6 +144,7 @@ preferences.other=其他 preferences.language=語言 preferences.lineNumbersMode=編輯器行號模式 preferences.jumpOnDoubleClick=啟用點擊兩下時跳躍 +#preferences.useAlternativeFileDialog=Use alternative file dialog preferences.check_for_updates=啟動時檢查更新 preferences.useDx=使用 dx/d8 來轉換 Java 位元組碼 preferences.decompilationMode=反編譯模式