summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/gui/Gui.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/Gui.java')
-rw-r--r--src/main/java/cuchaz/enigma/gui/Gui.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/Gui.java b/src/main/java/cuchaz/enigma/gui/Gui.java
index 8f0d6fa..3412cd5 100644
--- a/src/main/java/cuchaz/enigma/gui/Gui.java
+++ b/src/main/java/cuchaz/enigma/gui/Gui.java
@@ -33,6 +33,7 @@ import cuchaz.enigma.config.Config;
33import cuchaz.enigma.config.Themes; 33import cuchaz.enigma.config.Themes;
34import cuchaz.enigma.gui.dialog.CrashDialog; 34import cuchaz.enigma.gui.dialog.CrashDialog;
35import cuchaz.enigma.gui.dialog.JavadocDialog; 35import cuchaz.enigma.gui.dialog.JavadocDialog;
36import cuchaz.enigma.gui.dialog.SearchDialog;
36import cuchaz.enigma.gui.elements.MenuBar; 37import cuchaz.enigma.gui.elements.MenuBar;
37import cuchaz.enigma.gui.elements.PopupMenuBar; 38import cuchaz.enigma.gui.elements.PopupMenuBar;
38import cuchaz.enigma.gui.filechooser.FileChooserAny; 39import cuchaz.enigma.gui.filechooser.FileChooserAny;
@@ -67,6 +68,7 @@ public class Gui {
67 68
68 public FileDialog jarFileChooser; 69 public FileDialog jarFileChooser;
69 public FileDialog tinyMappingsFileChooser; 70 public FileDialog tinyMappingsFileChooser;
71 public SearchDialog searchDialog;
70 public JFileChooser enigmaMappingsFileChooser; 72 public JFileChooser enigmaMappingsFileChooser;
71 public JFileChooser exportSourceFileChooser; 73 public JFileChooser exportSourceFileChooser;
72 public FileDialog exportJarFileChooser; 74 public FileDialog exportJarFileChooser;
@@ -811,16 +813,15 @@ public class Gui {
811 public void close() { 813 public void close() {
812 if (!this.controller.isDirty()) { 814 if (!this.controller.isDirty()) {
813 // everything is saved, we can exit safely 815 // everything is saved, we can exit safely
814 this.frame.dispose(); 816 exit();
815 System.exit(0);
816 } else { 817 } else {
817 // ask to save before closing 818 // ask to save before closing
818 showDiscardDiag((response) -> { 819 showDiscardDiag((response) -> {
819 if (response == JOptionPane.YES_OPTION) { 820 if (response == JOptionPane.YES_OPTION) {
820 this.saveMapping(); 821 this.saveMapping();
821 this.frame.dispose(); 822 exit();
822 } else if (response == JOptionPane.NO_OPTION) { 823 } else if (response == JOptionPane.NO_OPTION) {
823 this.frame.dispose(); 824 exit();
824 } 825 }
825 826
826 return null; 827 return null;
@@ -828,6 +829,14 @@ public class Gui {
828 } 829 }
829 } 830 }
830 831
832 private void exit() {
833 if (searchDialog != null) {
834 searchDialog.dispose();
835 }
836 this.frame.dispose();
837 System.exit(0);
838 }
839
831 public void redraw() { 840 public void redraw() {
832 this.frame.validate(); 841 this.frame.validate();
833 this.frame.repaint(); 842 this.frame.repaint();
@@ -892,6 +901,10 @@ public class Gui {
892 this.obfPanel.obfClasses.restoreExpansionState(this.obfPanel.obfClasses, stateObf); 901 this.obfPanel.obfClasses.restoreExpansionState(this.obfPanel.obfClasses, stateObf);
893 } 902 }
894 903
904 public PanelObf getObfPanel() {
905 return obfPanel;
906 }
907
895 public PanelDeobf getDeobfPanel() { 908 public PanelDeobf getDeobfPanel() {
896 return deobfPanel; 909 return deobfPanel;
897 } 910 }
@@ -899,4 +912,12 @@ public class Gui {
899 public void setShouldNavigateOnClick(boolean shouldNavigateOnClick) { 912 public void setShouldNavigateOnClick(boolean shouldNavigateOnClick) {
900 this.shouldNavigateOnClick = shouldNavigateOnClick; 913 this.shouldNavigateOnClick = shouldNavigateOnClick;
901 } 914 }
915
916 public SearchDialog getSearchDialog() {
917 if (searchDialog == null) {
918 searchDialog = new SearchDialog(this);
919 }
920 return searchDialog;
921 }
922
902} 923}