diff options
| author | 2016-07-04 18:14:22 +1000 | |
|---|---|---|
| committer | 2016-07-04 18:14:22 +1000 | |
| commit | 59e189bef2b5e6d129fb7c2c988ed0b2130e36ac (patch) | |
| tree | 2b638e60905251de85a4917152d6fc39a4112194 /src/main/java/cuchaz/enigma/gui/Gui.java | |
| parent | Fixed Obf Class list order (diff) | |
| download | enigma-fork-59e189bef2b5e6d129fb7c2c988ed0b2130e36ac.tar.gz enigma-fork-59e189bef2b5e6d129fb7c2c988ed0b2130e36ac.tar.xz enigma-fork-59e189bef2b5e6d129fb7c2c988ed0b2130e36ac.zip | |
Reformat
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/Gui.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/Gui.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/Gui.java b/src/main/java/cuchaz/enigma/gui/Gui.java index 623e12e..d93aa9f 100644 --- a/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -36,11 +36,17 @@ import cuchaz.enigma.gui.elements.MenuBar; | |||
| 36 | import cuchaz.enigma.gui.elements.PopupMenuBar; | 36 | import cuchaz.enigma.gui.elements.PopupMenuBar; |
| 37 | import cuchaz.enigma.gui.filechooser.FileChooserFile; | 37 | import cuchaz.enigma.gui.filechooser.FileChooserFile; |
| 38 | import cuchaz.enigma.gui.filechooser.FileChooserFolder; | 38 | import cuchaz.enigma.gui.filechooser.FileChooserFolder; |
| 39 | import cuchaz.enigma.gui.highlight.DeobfuscatedHighlightPainter; | ||
| 40 | import cuchaz.enigma.gui.highlight.ObfuscatedHighlightPainter; | ||
| 41 | import cuchaz.enigma.gui.highlight.OtherHighlightPainter; | ||
| 42 | import cuchaz.enigma.gui.highlight.SelectionHighlightPainter; | ||
| 39 | import cuchaz.enigma.gui.panels.PanelDeobf; | 43 | import cuchaz.enigma.gui.panels.PanelDeobf; |
| 40 | import cuchaz.enigma.gui.panels.PanelEditor; | 44 | import cuchaz.enigma.gui.panels.PanelEditor; |
| 41 | import cuchaz.enigma.gui.panels.PanelIdentifier; | 45 | import cuchaz.enigma.gui.panels.PanelIdentifier; |
| 42 | import cuchaz.enigma.gui.panels.PanelObf; | 46 | import cuchaz.enigma.gui.panels.PanelObf; |
| 43 | import cuchaz.enigma.mapping.*; | 47 | import cuchaz.enigma.mapping.*; |
| 48 | import cuchaz.enigma.throwables.IllegalNameException; | ||
| 49 | import cuchaz.enigma.utils.Utils; | ||
| 44 | import de.sciss.syntaxpane.DefaultSyntaxKit; | 50 | import de.sciss.syntaxpane.DefaultSyntaxKit; |
| 45 | 51 | ||
| 46 | public class Gui { | 52 | public class Gui { |
| @@ -363,7 +369,7 @@ public class Gui { | |||
| 363 | if (token == null) { | 369 | if (token == null) { |
| 364 | throw new IllegalArgumentException("Token cannot be null!"); | 370 | throw new IllegalArgumentException("Token cannot be null!"); |
| 365 | } | 371 | } |
| 366 | CodeReader.navigateToToken(this.editor, token, m_selectionHighlightPainter); | 372 | Utils.navigateToToken(this.editor, token, m_selectionHighlightPainter); |
| 367 | redraw(); | 373 | redraw(); |
| 368 | } | 374 | } |
| 369 | 375 | ||
| @@ -476,7 +482,7 @@ public class Gui { | |||
| 476 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height)); | 482 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height)); |
| 477 | panel.add(label); | 483 | panel.add(label); |
| 478 | 484 | ||
| 479 | panel.add(GuiTricks.unboldLabel(new JLabel(value, JLabel.LEFT))); | 485 | panel.add(Utils.unboldLabel(new JLabel(value, JLabel.LEFT))); |
| 480 | } | 486 | } |
| 481 | 487 | ||
| 482 | public void onCaretMove(int pos) { | 488 | public void onCaretMove(int pos) { |
| @@ -498,13 +504,13 @@ public class Gui { | |||
| 498 | m_infoPanel.clearReference(); | 504 | m_infoPanel.clearReference(); |
| 499 | } | 505 | } |
| 500 | 506 | ||
| 501 | this.popupMenu.renameMenu.setEnabled(isRenameable && isToken); | 507 | this.popupMenu.renameMenu.setEnabled(isRenameable); |
| 502 | this.popupMenu.showInheritanceMenu.setEnabled(isClassEntry || isMethodEntry || isConstructorEntry); | 508 | this.popupMenu.showInheritanceMenu.setEnabled(isClassEntry || isMethodEntry || isConstructorEntry); |
| 503 | this.popupMenu.showImplementationsMenu.setEnabled(isClassEntry || isMethodEntry); | 509 | this.popupMenu.showImplementationsMenu.setEnabled(isClassEntry || isMethodEntry); |
| 504 | this.popupMenu.showCallsMenu.setEnabled(isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry); | 510 | this.popupMenu.showCallsMenu.setEnabled(isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry); |
| 505 | this.popupMenu.openEntryMenu.setEnabled(isInJar && (isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry)); | 511 | this.popupMenu.openEntryMenu.setEnabled(isInJar && (isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry)); |
| 506 | this.popupMenu.openPreviousMenu.setEnabled(this.controller.hasPreviousLocation()); | 512 | this.popupMenu.openPreviousMenu.setEnabled(this.controller.hasPreviousLocation()); |
| 507 | this.popupMenu.toggleMappingMenu.setEnabled(isRenameable && isToken); | 513 | this.popupMenu.toggleMappingMenu.setEnabled(isRenameable); |
| 508 | 514 | ||
| 509 | if (isToken && this.controller.entryHasDeobfuscatedName(m_reference.entry)) { | 515 | if (isToken && this.controller.entryHasDeobfuscatedName(m_reference.entry)) { |
| 510 | this.popupMenu.toggleMappingMenu.setText("Reset to obfuscated"); | 516 | this.popupMenu.toggleMappingMenu.setText("Reset to obfuscated"); |
| @@ -526,7 +532,6 @@ public class Gui { | |||
| 526 | 532 | ||
| 527 | private void navigateTo(EntryReference<Entry, Entry> reference) { | 533 | private void navigateTo(EntryReference<Entry, Entry> reference) { |
| 528 | if (!this.controller.entryIsInJar(reference.getLocationClassEntry())) { | 534 | if (!this.controller.entryIsInJar(reference.getLocationClassEntry())) { |
| 529 | // reference is not in the jar. Ignore it | ||
| 530 | return; | 535 | return; |
| 531 | } | 536 | } |
| 532 | if (m_reference != null) { | 537 | if (m_reference != null) { |
| @@ -574,7 +579,7 @@ public class Gui { | |||
| 574 | } catch (IllegalNameException ex) { | 579 | } catch (IllegalNameException ex) { |
| 575 | text.setBorder(BorderFactory.createLineBorder(Color.red, 1)); | 580 | text.setBorder(BorderFactory.createLineBorder(Color.red, 1)); |
| 576 | text.setToolTipText(ex.getReason()); | 581 | text.setToolTipText(ex.getReason()); |
| 577 | GuiTricks.showToolTipNow(text); | 582 | Utils.showToolTipNow(text); |
| 578 | } | 583 | } |
| 579 | return; | 584 | return; |
| 580 | } | 585 | } |
| @@ -582,7 +587,7 @@ public class Gui { | |||
| 582 | // abort the rename | 587 | // abort the rename |
| 583 | JPanel panel = (JPanel) m_infoPanel.getComponent(0); | 588 | JPanel panel = (JPanel) m_infoPanel.getComponent(0); |
| 584 | panel.remove(panel.getComponentCount() - 1); | 589 | panel.remove(panel.getComponentCount() - 1); |
| 585 | panel.add(GuiTricks.unboldLabel(new JLabel(m_reference.getNamableName(), JLabel.LEFT))); | 590 | panel.add(Utils.unboldLabel(new JLabel(m_reference.getNamableName(), JLabel.LEFT))); |
| 586 | 591 | ||
| 587 | this.editor.grabFocus(); | 592 | this.editor.grabFocus(); |
| 588 | 593 | ||
| @@ -704,6 +709,7 @@ public class Gui { | |||
| 704 | if (!this.controller.isDirty()) { | 709 | if (!this.controller.isDirty()) { |
| 705 | // everything is saved, we can exit safely | 710 | // everything is saved, we can exit safely |
| 706 | this.frame.dispose(); | 711 | this.frame.dispose(); |
| 712 | System.exit(0); | ||
| 707 | } else { | 713 | } else { |
| 708 | // ask to save before closing | 714 | // ask to save before closing |
| 709 | String[] options = {"Save and exit", "Discard changes", "Cancel"}; | 715 | String[] options = {"Save and exit", "Discard changes", "Cancel"}; |