diff options
| author | 2020-06-08 21:34:12 +0200 | |
|---|---|---|
| committer | 2020-06-08 21:34:12 +0200 | |
| commit | 4f488b964c258ac7410d71e810f0f8d2ba222818 (patch) | |
| tree | 657405a7c53feaf1ce4e43bc80f1cb9854e3a5b8 /enigma-swing/src/main/java | |
| parent | Add remap crash handler (diff) | |
| parent | No more prefix naming (diff) | |
| download | enigma-4f488b964c258ac7410d71e810f0f8d2ba222818.tar.gz enigma-4f488b964c258ac7410d71e810f0f8d2ba222818.tar.xz enigma-4f488b964c258ac7410d71e810f0f8d2ba222818.zip | |
Merge pull request #257 from 2xsaiko/classnames
No more prefix naming
Diffstat (limited to 'enigma-swing/src/main/java')
11 files changed, 120 insertions, 133 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java index 2ac15284..0b2de460 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -26,6 +26,7 @@ import javax.swing.tree.*; | |||
| 26 | 26 | ||
| 27 | import com.google.common.collect.HashBiMap; | 27 | import com.google.common.collect.HashBiMap; |
| 28 | import com.google.common.collect.Lists; | 28 | import com.google.common.collect.Lists; |
| 29 | |||
| 29 | import cuchaz.enigma.Enigma; | 30 | import cuchaz.enigma.Enigma; |
| 30 | import cuchaz.enigma.EnigmaProfile; | 31 | import cuchaz.enigma.EnigmaProfile; |
| 31 | import cuchaz.enigma.analysis.*; | 32 | import cuchaz.enigma.analysis.*; |
| @@ -40,8 +41,6 @@ import cuchaz.enigma.gui.elements.EditorTabPopupMenu; | |||
| 40 | import cuchaz.enigma.gui.elements.MenuBar; | 41 | import cuchaz.enigma.gui.elements.MenuBar; |
| 41 | import cuchaz.enigma.gui.elements.ValidatableUi; | 42 | import cuchaz.enigma.gui.elements.ValidatableUi; |
| 42 | import cuchaz.enigma.gui.events.EditorActionListener; | 43 | import cuchaz.enigma.gui.events.EditorActionListener; |
| 43 | import cuchaz.enigma.gui.filechooser.FileChooserAny; | ||
| 44 | import cuchaz.enigma.gui.filechooser.FileChooserFolder; | ||
| 45 | import cuchaz.enigma.gui.panels.*; | 44 | import cuchaz.enigma.gui.panels.*; |
| 46 | import cuchaz.enigma.gui.util.History; | 45 | import cuchaz.enigma.gui.util.History; |
| 47 | import cuchaz.enigma.gui.util.ScaleUtil; | 46 | import cuchaz.enigma.gui.util.ScaleUtil; |
| @@ -62,8 +61,8 @@ import cuchaz.enigma.utils.validation.ValidationContext; | |||
| 62 | 61 | ||
| 63 | public class Gui { | 62 | public class Gui { |
| 64 | 63 | ||
| 65 | private final PanelObf obfPanel; | 64 | private final ObfPanel obfPanel; |
| 66 | private final PanelDeobf deobfPanel; | 65 | private final DeobfPanel deobfPanel; |
| 67 | 66 | ||
| 68 | private final MenuBar menuBar; | 67 | private final MenuBar menuBar; |
| 69 | 68 | ||
| @@ -82,7 +81,7 @@ public class Gui { | |||
| 82 | private JFrame frame; | 81 | private JFrame frame; |
| 83 | private JPanel classesPanel; | 82 | private JPanel classesPanel; |
| 84 | private JSplitPane splitClasses; | 83 | private JSplitPane splitClasses; |
| 85 | private PanelIdentifier infoPanel; | 84 | private IdentifierPanel infoPanel; |
| 86 | private JTree inheritanceTree; | 85 | private JTree inheritanceTree; |
| 87 | private JTree implementationsTree; | 86 | private JTree implementationsTree; |
| 88 | private JTree callsTree; | 87 | private JTree callsTree; |
| @@ -105,7 +104,7 @@ public class Gui { | |||
| 105 | 104 | ||
| 106 | private final EditorTabPopupMenu editorTabPopupMenu; | 105 | private final EditorTabPopupMenu editorTabPopupMenu; |
| 107 | private final JTabbedPane openFiles; | 106 | private final JTabbedPane openFiles; |
| 108 | private final HashBiMap<ClassEntry, PanelEditor> editors = HashBiMap.create(); | 107 | private final HashBiMap<ClassEntry, EditorPanel> editors = HashBiMap.create(); |
| 109 | 108 | ||
| 110 | public Gui(EnigmaProfile profile) { | 109 | public Gui(EnigmaProfile profile) { |
| 111 | Config.getInstance().lookAndFeel.setGlobalLAF(); | 110 | Config.getInstance().lookAndFeel.setGlobalLAF(); |
| @@ -138,12 +137,19 @@ public class Gui { | |||
| 138 | this.jarFileChooser = new FileDialog(getFrame(), I18n.translate("menu.file.jar.open"), FileDialog.LOAD); | 137 | this.jarFileChooser = new FileDialog(getFrame(), I18n.translate("menu.file.jar.open"), FileDialog.LOAD); |
| 139 | 138 | ||
| 140 | this.tinyMappingsFileChooser = new FileDialog(getFrame(), "Open tiny Mappings", FileDialog.LOAD); | 139 | this.tinyMappingsFileChooser = new FileDialog(getFrame(), "Open tiny Mappings", FileDialog.LOAD); |
| 141 | this.enigmaMappingsFileChooser = new FileChooserAny(); | 140 | |
| 142 | this.exportSourceFileChooser = new FileChooserFolder(); | 141 | this.enigmaMappingsFileChooser = new JFileChooser(); |
| 142 | this.enigmaMappingsFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); | ||
| 143 | this.enigmaMappingsFileChooser.setAcceptAllFileFilterUsed(false); | ||
| 144 | |||
| 145 | this.exportSourceFileChooser = new JFileChooser(); | ||
| 146 | this.exportSourceFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); | ||
| 147 | this.exportSourceFileChooser.setAcceptAllFileFilterUsed(false); | ||
| 148 | |||
| 143 | this.exportJarFileChooser = new FileDialog(getFrame(), I18n.translate("menu.file.export.jar"), FileDialog.SAVE); | 149 | this.exportJarFileChooser = new FileDialog(getFrame(), I18n.translate("menu.file.export.jar"), FileDialog.SAVE); |
| 144 | 150 | ||
| 145 | this.obfPanel = new PanelObf(this); | 151 | this.obfPanel = new ObfPanel(this); |
| 146 | this.deobfPanel = new PanelDeobf(this); | 152 | this.deobfPanel = new DeobfPanel(this); |
| 147 | 153 | ||
| 148 | // set up classes panel (don't add the splitter yet) | 154 | // set up classes panel (don't add the splitter yet) |
| 149 | splitClasses = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, this.obfPanel, this.deobfPanel); | 155 | splitClasses = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, this.obfPanel, this.deobfPanel); |
| @@ -153,7 +159,7 @@ public class Gui { | |||
| 153 | this.classesPanel.setPreferredSize(ScaleUtil.getDimension(250, 0)); | 159 | this.classesPanel.setPreferredSize(ScaleUtil.getDimension(250, 0)); |
| 154 | 160 | ||
| 155 | // init info panel | 161 | // init info panel |
| 156 | infoPanel = new PanelIdentifier(this); | 162 | infoPanel = new IdentifierPanel(this); |
| 157 | 163 | ||
| 158 | // init inheritance panel | 164 | // init inheritance panel |
| 159 | inheritanceTree = new JTree(); | 165 | inheritanceTree = new JTree(); |
| @@ -276,7 +282,7 @@ public class Gui { | |||
| 276 | if (SwingUtilities.isRightMouseButton(e)) { | 282 | if (SwingUtilities.isRightMouseButton(e)) { |
| 277 | int i = openFiles.getUI().tabForCoordinate(openFiles, e.getX(), e.getY()); | 283 | int i = openFiles.getUI().tabForCoordinate(openFiles, e.getX(), e.getY()); |
| 278 | if (i != -1) { | 284 | if (i != -1) { |
| 279 | editorTabPopupMenu.show(openFiles, e.getX(), e.getY(), PanelEditor.byUi(openFiles.getComponentAt(i))); | 285 | editorTabPopupMenu.show(openFiles, e.getX(), e.getY(), EditorPanel.byUi(openFiles.getComponentAt(i))); |
| 280 | } | 286 | } |
| 281 | } | 287 | } |
| 282 | } | 288 | } |
| @@ -403,11 +409,11 @@ public class Gui { | |||
| 403 | redraw(); | 409 | redraw(); |
| 404 | } | 410 | } |
| 405 | 411 | ||
| 406 | public PanelEditor openClass(ClassEntry entry) { | 412 | public EditorPanel openClass(ClassEntry entry) { |
| 407 | PanelEditor panelEditor = editors.computeIfAbsent(entry, e -> { | 413 | EditorPanel editorPanel = editors.computeIfAbsent(entry, e -> { |
| 408 | ClassHandle ch = controller.getClassHandleProvider().openClass(entry); | 414 | ClassHandle ch = controller.getClassHandleProvider().openClass(entry); |
| 409 | if (ch == null) return null; | 415 | if (ch == null) return null; |
| 410 | PanelEditor ed = new PanelEditor(this); | 416 | EditorPanel ed = new EditorPanel(this); |
| 411 | ed.setup(); | 417 | ed.setup(); |
| 412 | ed.setClassHandle(ch); | 418 | ed.setClassHandle(ch); |
| 413 | openFiles.addTab(ed.getFileName(), ed.getUi()); | 419 | openFiles.addTab(ed.getFileName(), ed.getUi()); |
| @@ -418,18 +424,18 @@ public class Gui { | |||
| 418 | 424 | ||
| 419 | ed.addListener(new EditorActionListener() { | 425 | ed.addListener(new EditorActionListener() { |
| 420 | @Override | 426 | @Override |
| 421 | public void onCursorReferenceChanged(PanelEditor editor, EntryReference<Entry<?>, Entry<?>> ref) { | 427 | public void onCursorReferenceChanged(EditorPanel editor, EntryReference<Entry<?>, Entry<?>> ref) { |
| 422 | updateSelectedReference(editor, ref); | 428 | updateSelectedReference(editor, ref); |
| 423 | } | 429 | } |
| 424 | 430 | ||
| 425 | @Override | 431 | @Override |
| 426 | public void onClassHandleChanged(PanelEditor editor, ClassEntry old, ClassHandle ch) { | 432 | public void onClassHandleChanged(EditorPanel editor, ClassEntry old, ClassHandle ch) { |
| 427 | editors.remove(old); | 433 | editors.remove(old); |
| 428 | editors.put(ch.getRef(), editor); | 434 | editors.put(ch.getRef(), editor); |
| 429 | } | 435 | } |
| 430 | 436 | ||
| 431 | @Override | 437 | @Override |
| 432 | public void onTitleChanged(PanelEditor editor, String title) { | 438 | public void onTitleChanged(EditorPanel editor, String title) { |
| 433 | titlePane.setText(editor.getFileName()); | 439 | titlePane.setText(editor.getFileName()); |
| 434 | } | 440 | } |
| 435 | }); | 441 | }); |
| @@ -445,10 +451,10 @@ public class Gui { | |||
| 445 | 451 | ||
| 446 | return ed; | 452 | return ed; |
| 447 | }); | 453 | }); |
| 448 | if (panelEditor != null) { | 454 | if (editorPanel != null) { |
| 449 | openFiles.setSelectedComponent(editors.get(entry).getUi()); | 455 | openFiles.setSelectedComponent(editors.get(entry).getUi()); |
| 450 | } | 456 | } |
| 451 | return panelEditor; | 457 | return editorPanel; |
| 452 | } | 458 | } |
| 453 | 459 | ||
| 454 | public void setObfClasses(Collection<ClassEntry> obfClasses) { | 460 | public void setObfClasses(Collection<ClassEntry> obfClasses) { |
| @@ -464,44 +470,44 @@ public class Gui { | |||
| 464 | updateUiState(); | 470 | updateUiState(); |
| 465 | } | 471 | } |
| 466 | 472 | ||
| 467 | public void closeEditor(PanelEditor ed) { | 473 | public void closeEditor(EditorPanel ed) { |
| 468 | openFiles.remove(ed.getUi()); | 474 | openFiles.remove(ed.getUi()); |
| 469 | editors.inverse().remove(ed); | 475 | editors.inverse().remove(ed); |
| 470 | ed.destroy(); | 476 | ed.destroy(); |
| 471 | } | 477 | } |
| 472 | 478 | ||
| 473 | public void closeAllEditorTabs() { | 479 | public void closeAllEditorTabs() { |
| 474 | for (Iterator<PanelEditor> iter = editors.values().iterator(); iter.hasNext(); ) { | 480 | for (Iterator<EditorPanel> iter = editors.values().iterator(); iter.hasNext(); ) { |
| 475 | PanelEditor e = iter.next(); | 481 | EditorPanel e = iter.next(); |
| 476 | openFiles.remove(e.getUi()); | 482 | openFiles.remove(e.getUi()); |
| 477 | e.destroy(); | 483 | e.destroy(); |
| 478 | iter.remove(); | 484 | iter.remove(); |
| 479 | } | 485 | } |
| 480 | } | 486 | } |
| 481 | 487 | ||
| 482 | public void closeTabsLeftOf(PanelEditor ed) { | 488 | public void closeTabsLeftOf(EditorPanel ed) { |
| 483 | int index = openFiles.indexOfComponent(ed.getUi()); | 489 | int index = openFiles.indexOfComponent(ed.getUi()); |
| 484 | for (int i = index - 1; i >= 0; i--) { | 490 | for (int i = index - 1; i >= 0; i--) { |
| 485 | closeEditor(PanelEditor.byUi(openFiles.getComponentAt(i))); | 491 | closeEditor(EditorPanel.byUi(openFiles.getComponentAt(i))); |
| 486 | } | 492 | } |
| 487 | } | 493 | } |
| 488 | 494 | ||
| 489 | public void closeTabsRightOf(PanelEditor ed) { | 495 | public void closeTabsRightOf(EditorPanel ed) { |
| 490 | int index = openFiles.indexOfComponent(ed.getUi()); | 496 | int index = openFiles.indexOfComponent(ed.getUi()); |
| 491 | for (int i = openFiles.getTabCount() - 1; i > index; i--) { | 497 | for (int i = openFiles.getTabCount() - 1; i > index; i--) { |
| 492 | closeEditor(PanelEditor.byUi(openFiles.getComponentAt(i))); | 498 | closeEditor(EditorPanel.byUi(openFiles.getComponentAt(i))); |
| 493 | } | 499 | } |
| 494 | } | 500 | } |
| 495 | 501 | ||
| 496 | public void closeTabsExcept(PanelEditor ed) { | 502 | public void closeTabsExcept(EditorPanel ed) { |
| 497 | int index = openFiles.indexOfComponent(ed.getUi()); | 503 | int index = openFiles.indexOfComponent(ed.getUi()); |
| 498 | for (int i = openFiles.getTabCount() - 1; i >= 0; i--) { | 504 | for (int i = openFiles.getTabCount() - 1; i >= 0; i--) { |
| 499 | if (i == index) continue; | 505 | if (i == index) continue; |
| 500 | closeEditor(PanelEditor.byUi(openFiles.getComponentAt(i))); | 506 | closeEditor(EditorPanel.byUi(openFiles.getComponentAt(i))); |
| 501 | } | 507 | } |
| 502 | } | 508 | } |
| 503 | 509 | ||
| 504 | public void showTokens(PanelEditor editor, Collection<Token> tokens) { | 510 | public void showTokens(EditorPanel editor, Collection<Token> tokens) { |
| 505 | Vector<Token> sortedTokens = new Vector<>(tokens); | 511 | Vector<Token> sortedTokens = new Vector<>(tokens); |
| 506 | Collections.sort(sortedTokens); | 512 | Collections.sort(sortedTokens); |
| 507 | if (sortedTokens.size() > 1) { | 513 | if (sortedTokens.size() > 1) { |
| @@ -517,7 +523,7 @@ public class Gui { | |||
| 517 | editor.navigateToToken(sortedTokens.get(0)); | 523 | editor.navigateToToken(sortedTokens.get(0)); |
| 518 | } | 524 | } |
| 519 | 525 | ||
| 520 | private void updateSelectedReference(PanelEditor editor, EntryReference<Entry<?>, Entry<?>> ref) { | 526 | private void updateSelectedReference(EditorPanel editor, EntryReference<Entry<?>, Entry<?>> ref) { |
| 521 | if (editor != getActiveEditor()) return; | 527 | if (editor != getActiveEditor()) return; |
| 522 | 528 | ||
| 523 | showCursorReference(ref); | 529 | showCursorReference(ref); |
| @@ -528,35 +534,35 @@ public class Gui { | |||
| 528 | } | 534 | } |
| 529 | 535 | ||
| 530 | @Nullable | 536 | @Nullable |
| 531 | public PanelEditor getActiveEditor() { | 537 | public EditorPanel getActiveEditor() { |
| 532 | return PanelEditor.byUi(openFiles.getSelectedComponent()); | 538 | return EditorPanel.byUi(openFiles.getSelectedComponent()); |
| 533 | } | 539 | } |
| 534 | 540 | ||
| 535 | @Nullable | 541 | @Nullable |
| 536 | public EntryReference<Entry<?>, Entry<?>> getCursorReference() { | 542 | public EntryReference<Entry<?>, Entry<?>> getCursorReference() { |
| 537 | PanelEditor activeEditor = getActiveEditor(); | 543 | EditorPanel activeEditor = getActiveEditor(); |
| 538 | return activeEditor == null ? null : activeEditor.getCursorReference(); | 544 | return activeEditor == null ? null : activeEditor.getCursorReference(); |
| 539 | } | 545 | } |
| 540 | 546 | ||
| 541 | public void startDocChange(PanelEditor editor) { | 547 | public void startDocChange(EditorPanel editor) { |
| 542 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); | 548 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); |
| 543 | if (cursorReference == null) return; | 549 | if (cursorReference == null) return; |
| 544 | JavadocDialog.show(frame, getController(), cursorReference); | 550 | JavadocDialog.show(frame, getController(), cursorReference); |
| 545 | } | 551 | } |
| 546 | 552 | ||
| 547 | public void startRename(PanelEditor editor, String text) { | 553 | public void startRename(EditorPanel editor, String text) { |
| 548 | if (editor != getActiveEditor()) return; | 554 | if (editor != getActiveEditor()) return; |
| 549 | 555 | ||
| 550 | infoPanel.startRenaming(text); | 556 | infoPanel.startRenaming(text); |
| 551 | } | 557 | } |
| 552 | 558 | ||
| 553 | public void startRename(PanelEditor editor) { | 559 | public void startRename(EditorPanel editor) { |
| 554 | if (editor != getActiveEditor()) return; | 560 | if (editor != getActiveEditor()) return; |
| 555 | 561 | ||
| 556 | infoPanel.startRenaming(); | 562 | infoPanel.startRenaming(); |
| 557 | } | 563 | } |
| 558 | 564 | ||
| 559 | public void showInheritance(PanelEditor editor) { | 565 | public void showInheritance(EditorPanel editor) { |
| 560 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); | 566 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); |
| 561 | if (cursorReference == null) return; | 567 | if (cursorReference == null) return; |
| 562 | 568 | ||
| @@ -587,7 +593,7 @@ public class Gui { | |||
| 587 | redraw(); | 593 | redraw(); |
| 588 | } | 594 | } |
| 589 | 595 | ||
| 590 | public void showImplementations(PanelEditor editor) { | 596 | public void showImplementations(EditorPanel editor) { |
| 591 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); | 597 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); |
| 592 | if (cursorReference == null) return; | 598 | if (cursorReference == null) return; |
| 593 | 599 | ||
| @@ -615,7 +621,7 @@ public class Gui { | |||
| 615 | redraw(); | 621 | redraw(); |
| 616 | } | 622 | } |
| 617 | 623 | ||
| 618 | public void showCalls(PanelEditor editor, boolean recurse) { | 624 | public void showCalls(EditorPanel editor, boolean recurse) { |
| 619 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); | 625 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); |
| 620 | if (cursorReference == null) return; | 626 | if (cursorReference == null) return; |
| 621 | 627 | ||
| @@ -635,7 +641,7 @@ public class Gui { | |||
| 635 | redraw(); | 641 | redraw(); |
| 636 | } | 642 | } |
| 637 | 643 | ||
| 638 | public void toggleMapping(PanelEditor editor) { | 644 | public void toggleMapping(EditorPanel editor) { |
| 639 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); | 645 | EntryReference<Entry<?>, Entry<?>> cursorReference = editor.getCursorReference(); |
| 640 | if (cursorReference == null) return; | 646 | if (cursorReference == null) return; |
| 641 | 647 | ||
| @@ -781,11 +787,11 @@ public class Gui { | |||
| 781 | this.obfPanel.obfClasses.restoreExpansionState(this.obfPanel.obfClasses, stateObf); | 787 | this.obfPanel.obfClasses.restoreExpansionState(this.obfPanel.obfClasses, stateObf); |
| 782 | } | 788 | } |
| 783 | 789 | ||
| 784 | public PanelObf getObfPanel() { | 790 | public ObfPanel getObfPanel() { |
| 785 | return obfPanel; | 791 | return obfPanel; |
| 786 | } | 792 | } |
| 787 | 793 | ||
| 788 | public PanelDeobf getDeobfPanel() { | 794 | public DeobfPanel getDeobfPanel() { |
| 789 | return deobfPanel; | 795 | return deobfPanel; |
| 790 | } | 796 | } |
| 791 | 797 | ||
| @@ -858,7 +864,7 @@ public class Gui { | |||
| 858 | return this.connectionState; | 864 | return this.connectionState; |
| 859 | } | 865 | } |
| 860 | 866 | ||
| 861 | public PanelIdentifier getInfoPanel() { | 867 | public IdentifierPanel getInfoPanel() { |
| 862 | return infoPanel; | 868 | return infoPanel; |
| 863 | } | 869 | } |
| 864 | 870 | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/EditorTabPopupMenu.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/EditorTabPopupMenu.java index e92e6773..39ed9789 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/EditorTabPopupMenu.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/EditorTabPopupMenu.java | |||
| @@ -8,7 +8,7 @@ import javax.swing.JPopupMenu; | |||
| 8 | import javax.swing.KeyStroke; | 8 | import javax.swing.KeyStroke; |
| 9 | 9 | ||
| 10 | import cuchaz.enigma.gui.Gui; | 10 | import cuchaz.enigma.gui.Gui; |
| 11 | import cuchaz.enigma.gui.panels.PanelEditor; | 11 | import cuchaz.enigma.gui.panels.EditorPanel; |
| 12 | import cuchaz.enigma.utils.I18n; | 12 | import cuchaz.enigma.utils.I18n; |
| 13 | 13 | ||
| 14 | public class EditorTabPopupMenu { | 14 | public class EditorTabPopupMenu { |
| @@ -21,7 +21,7 @@ public class EditorTabPopupMenu { | |||
| 21 | private final JMenuItem closeRight; | 21 | private final JMenuItem closeRight; |
| 22 | 22 | ||
| 23 | private final Gui gui; | 23 | private final Gui gui; |
| 24 | private PanelEditor editor; | 24 | private EditorPanel editor; |
| 25 | 25 | ||
| 26 | public EditorTabPopupMenu(Gui gui) { | 26 | public EditorTabPopupMenu(Gui gui) { |
| 27 | this.gui = gui; | 27 | this.gui = gui; |
| @@ -50,8 +50,8 @@ public class EditorTabPopupMenu { | |||
| 50 | this.ui.add(this.closeRight); | 50 | this.ui.add(this.closeRight); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | public void show(Component invoker, int x, int y, PanelEditor panelEditor) { | 53 | public void show(Component invoker, int x, int y, EditorPanel editorPanel) { |
| 54 | this.editor = panelEditor; | 54 | this.editor = editorPanel; |
| 55 | ui.show(invoker, x, y); | 55 | ui.show(invoker, x, y); |
| 56 | } | 56 | } |
| 57 | 57 | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java index 2310cf32..ad6dac6b 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java | |||
| @@ -1,13 +1,17 @@ | |||
| 1 | package cuchaz.enigma.gui.elements; | 1 | package cuchaz.enigma.gui.elements; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.gui.Gui; | ||
| 4 | import cuchaz.enigma.gui.panels.PanelEditor; | ||
| 5 | import cuchaz.enigma.utils.I18n; | ||
| 6 | |||
| 7 | import javax.swing.*; | ||
| 8 | import java.awt.event.InputEvent; | 3 | import java.awt.event.InputEvent; |
| 9 | import java.awt.event.KeyEvent; | 4 | import java.awt.event.KeyEvent; |
| 10 | 5 | ||
| 6 | import javax.swing.JMenuItem; | ||
| 7 | import javax.swing.JPopupMenu; | ||
| 8 | import javax.swing.JSeparator; | ||
| 9 | import javax.swing.KeyStroke; | ||
| 10 | |||
| 11 | import cuchaz.enigma.gui.Gui; | ||
| 12 | import cuchaz.enigma.gui.panels.EditorPanel; | ||
| 13 | import cuchaz.enigma.utils.I18n; | ||
| 14 | |||
| 11 | public class PopupMenuBar extends JPopupMenu { | 15 | public class PopupMenuBar extends JPopupMenu { |
| 12 | 16 | ||
| 13 | public final JMenuItem renameMenu; | 17 | public final JMenuItem renameMenu; |
| @@ -21,7 +25,7 @@ public class PopupMenuBar extends JPopupMenu { | |||
| 21 | public final JMenuItem openNextMenu; | 25 | public final JMenuItem openNextMenu; |
| 22 | public final JMenuItem toggleMappingMenu; | 26 | public final JMenuItem toggleMappingMenu; |
| 23 | 27 | ||
| 24 | public PopupMenuBar(PanelEditor editor, Gui gui) { | 28 | public PopupMenuBar(EditorPanel editor, Gui gui) { |
| 25 | { | 29 | { |
| 26 | JMenuItem menu = new JMenuItem(I18n.translate("popup_menu.rename")); | 30 | JMenuItem menu = new JMenuItem(I18n.translate("popup_menu.rename")); |
| 27 | menu.addActionListener(event -> gui.startRename(editor)); | 31 | menu.addActionListener(event -> gui.startRename(editor)); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/events/EditorActionListener.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/events/EditorActionListener.java index 88807314..48c9ec4b 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/events/EditorActionListener.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/events/EditorActionListener.java | |||
| @@ -1,20 +1,20 @@ | |||
| 1 | package cuchaz.enigma.gui.events; | 1 | package cuchaz.enigma.gui.events; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.analysis.EntryReference; | 3 | import cuchaz.enigma.analysis.EntryReference; |
| 4 | import cuchaz.enigma.gui.panels.PanelEditor; | ||
| 5 | import cuchaz.enigma.classhandle.ClassHandle; | 4 | import cuchaz.enigma.classhandle.ClassHandle; |
| 5 | import cuchaz.enigma.gui.panels.EditorPanel; | ||
| 6 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 6 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 7 | import cuchaz.enigma.translation.representation.entry.Entry; | 7 | import cuchaz.enigma.translation.representation.entry.Entry; |
| 8 | 8 | ||
| 9 | public interface EditorActionListener { | 9 | public interface EditorActionListener { |
| 10 | 10 | ||
| 11 | default void onCursorReferenceChanged(PanelEditor editor, EntryReference<Entry<?>, Entry<?>> ref) { | 11 | default void onCursorReferenceChanged(EditorPanel editor, EntryReference<Entry<?>, Entry<?>> ref) { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | default void onClassHandleChanged(PanelEditor editor, ClassEntry old, ClassHandle ch) { | 14 | default void onClassHandleChanged(EditorPanel editor, ClassEntry old, ClassHandle ch) { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | default void onTitleChanged(PanelEditor editor, String title) { | 17 | default void onTitleChanged(EditorPanel editor, String title) { |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | } | 20 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserAny.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserAny.java deleted file mode 100644 index f5f66287..00000000 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserAny.java +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | package cuchaz.enigma.gui.filechooser; | ||
| 2 | |||
| 3 | import javax.swing.*; | ||
| 4 | |||
| 5 | public class FileChooserAny extends JFileChooser { | ||
| 6 | public FileChooserAny() { | ||
| 7 | this.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); | ||
| 8 | this.setAcceptAllFileFilterUsed(false); | ||
| 9 | } | ||
| 10 | } \ No newline at end of file | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserFile.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserFile.java deleted file mode 100644 index cea11a68..00000000 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserFile.java +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | package cuchaz.enigma.gui.filechooser; | ||
| 2 | |||
| 3 | import javax.swing.*; | ||
| 4 | |||
| 5 | public class FileChooserFile extends JFileChooser { | ||
| 6 | public FileChooserFile() { | ||
| 7 | } | ||
| 8 | } | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserFolder.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserFolder.java deleted file mode 100644 index c16e0afc..00000000 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/filechooser/FileChooserFolder.java +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | package cuchaz.enigma.gui.filechooser; | ||
| 2 | |||
| 3 | import javax.swing.*; | ||
| 4 | |||
| 5 | public class FileChooserFolder extends JFileChooser { | ||
| 6 | |||
| 7 | public FileChooserFolder() { | ||
| 8 | this.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); | ||
| 9 | this.setAcceptAllFileFilterUsed(false); | ||
| 10 | } | ||
| 11 | } | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelDeobf.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/DeobfPanel.java index c24226b3..bb8acc8e 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelDeobf.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/DeobfPanel.java | |||
| @@ -1,18 +1,21 @@ | |||
| 1 | package cuchaz.enigma.gui.panels; | 1 | package cuchaz.enigma.gui.panels; |
| 2 | 2 | ||
| 3 | import java.awt.BorderLayout; | ||
| 4 | |||
| 5 | import javax.swing.JLabel; | ||
| 6 | import javax.swing.JPanel; | ||
| 7 | import javax.swing.JScrollPane; | ||
| 8 | |||
| 3 | import cuchaz.enigma.gui.ClassSelector; | 9 | import cuchaz.enigma.gui.ClassSelector; |
| 4 | import cuchaz.enigma.gui.Gui; | 10 | import cuchaz.enigma.gui.Gui; |
| 5 | import cuchaz.enigma.utils.I18n; | 11 | import cuchaz.enigma.utils.I18n; |
| 6 | 12 | ||
| 7 | import javax.swing.*; | 13 | public class DeobfPanel extends JPanel { |
| 8 | import java.awt.*; | ||
| 9 | |||
| 10 | public class PanelDeobf extends JPanel { | ||
| 11 | 14 | ||
| 12 | public final ClassSelector deobfClasses; | 15 | public final ClassSelector deobfClasses; |
| 13 | private final Gui gui; | 16 | private final Gui gui; |
| 14 | 17 | ||
| 15 | public PanelDeobf(Gui gui) { | 18 | public DeobfPanel(Gui gui) { |
| 16 | this.gui = gui; | 19 | this.gui = gui; |
| 17 | 20 | ||
| 18 | this.deobfClasses = new ClassSelector(gui, ClassSelector.DEOBF_CLASS_COMPARATOR, true); | 21 | this.deobfClasses = new ClassSelector(gui, ClassSelector.DEOBF_CLASS_COMPARATOR, true); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java index bf1d5fb2..f689a211 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java | |||
| @@ -45,7 +45,7 @@ import cuchaz.enigma.translation.representation.entry.MethodEntry; | |||
| 45 | import cuchaz.enigma.utils.I18n; | 45 | import cuchaz.enigma.utils.I18n; |
| 46 | import cuchaz.enigma.utils.Result; | 46 | import cuchaz.enigma.utils.Result; |
| 47 | 47 | ||
| 48 | public class PanelEditor { | 48 | public class EditorPanel { |
| 49 | 49 | ||
| 50 | private final JPanel ui = new JPanel(); | 50 | private final JPanel ui = new JPanel(); |
| 51 | private final JEditorPane editor = new JEditorPane(); | 51 | private final JEditorPane editor = new JEditorPane(); |
| @@ -83,7 +83,7 @@ public class PanelEditor { | |||
| 83 | private DecompiledClassSource source; | 83 | private DecompiledClassSource source; |
| 84 | private boolean settingSource; | 84 | private boolean settingSource; |
| 85 | 85 | ||
| 86 | public PanelEditor(Gui gui) { | 86 | public EditorPanel(Gui gui) { |
| 87 | this.gui = gui; | 87 | this.gui = gui; |
| 88 | this.controller = gui.getController(); | 88 | this.controller = gui.getController(); |
| 89 | 89 | ||
| @@ -112,14 +112,14 @@ public class PanelEditor { | |||
| 112 | this.editor.addMouseListener(new MouseAdapter() { | 112 | this.editor.addMouseListener(new MouseAdapter() { |
| 113 | @Override | 113 | @Override |
| 114 | public void mousePressed(MouseEvent mouseEvent) { | 114 | public void mousePressed(MouseEvent mouseEvent) { |
| 115 | PanelEditor.this.mouseIsPressed = true; | 115 | EditorPanel.this.mouseIsPressed = true; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | @Override | 118 | @Override |
| 119 | public void mouseReleased(MouseEvent e) { | 119 | public void mouseReleased(MouseEvent e) { |
| 120 | switch (e.getButton()) { | 120 | switch (e.getButton()) { |
| 121 | case MouseEvent.BUTTON3: // Right click | 121 | case MouseEvent.BUTTON3: // Right click |
| 122 | PanelEditor.this.editor.setCaretPosition(PanelEditor.this.editor.viewToModel(e.getPoint())); | 122 | EditorPanel.this.editor.setCaretPosition(EditorPanel.this.editor.viewToModel(e.getPoint())); |
| 123 | break; | 123 | break; |
| 124 | 124 | ||
| 125 | case 4: // Back navigation | 125 | case 4: // Back navigation |
| @@ -130,58 +130,58 @@ public class PanelEditor { | |||
| 130 | gui.getController().openNextReference(); | 130 | gui.getController().openNextReference(); |
| 131 | break; | 131 | break; |
| 132 | } | 132 | } |
| 133 | PanelEditor.this.mouseIsPressed = false; | 133 | EditorPanel.this.mouseIsPressed = false; |
| 134 | } | 134 | } |
| 135 | }); | 135 | }); |
| 136 | this.editor.addKeyListener(new KeyAdapter() { | 136 | this.editor.addKeyListener(new KeyAdapter() { |
| 137 | @Override | 137 | @Override |
| 138 | public void keyPressed(KeyEvent event) { | 138 | public void keyPressed(KeyEvent event) { |
| 139 | if (event.isControlDown()) { | 139 | if (event.isControlDown()) { |
| 140 | PanelEditor.this.shouldNavigateOnClick = false; | 140 | EditorPanel.this.shouldNavigateOnClick = false; |
| 141 | switch (event.getKeyCode()) { | 141 | switch (event.getKeyCode()) { |
| 142 | case KeyEvent.VK_I: | 142 | case KeyEvent.VK_I: |
| 143 | PanelEditor.this.popupMenu.showInheritanceMenu.doClick(); | 143 | EditorPanel.this.popupMenu.showInheritanceMenu.doClick(); |
| 144 | break; | 144 | break; |
| 145 | 145 | ||
| 146 | case KeyEvent.VK_M: | 146 | case KeyEvent.VK_M: |
| 147 | PanelEditor.this.popupMenu.showImplementationsMenu.doClick(); | 147 | EditorPanel.this.popupMenu.showImplementationsMenu.doClick(); |
| 148 | break; | 148 | break; |
| 149 | 149 | ||
| 150 | case KeyEvent.VK_N: | 150 | case KeyEvent.VK_N: |
| 151 | PanelEditor.this.popupMenu.openEntryMenu.doClick(); | 151 | EditorPanel.this.popupMenu.openEntryMenu.doClick(); |
| 152 | break; | 152 | break; |
| 153 | 153 | ||
| 154 | case KeyEvent.VK_P: | 154 | case KeyEvent.VK_P: |
| 155 | PanelEditor.this.popupMenu.openPreviousMenu.doClick(); | 155 | EditorPanel.this.popupMenu.openPreviousMenu.doClick(); |
| 156 | break; | 156 | break; |
| 157 | 157 | ||
| 158 | case KeyEvent.VK_E: | 158 | case KeyEvent.VK_E: |
| 159 | PanelEditor.this.popupMenu.openNextMenu.doClick(); | 159 | EditorPanel.this.popupMenu.openNextMenu.doClick(); |
| 160 | break; | 160 | break; |
| 161 | 161 | ||
| 162 | case KeyEvent.VK_C: | 162 | case KeyEvent.VK_C: |
| 163 | if (event.isShiftDown()) { | 163 | if (event.isShiftDown()) { |
| 164 | PanelEditor.this.popupMenu.showCallsSpecificMenu.doClick(); | 164 | EditorPanel.this.popupMenu.showCallsSpecificMenu.doClick(); |
| 165 | } else { | 165 | } else { |
| 166 | PanelEditor.this.popupMenu.showCallsMenu.doClick(); | 166 | EditorPanel.this.popupMenu.showCallsMenu.doClick(); |
| 167 | } | 167 | } |
| 168 | break; | 168 | break; |
| 169 | 169 | ||
| 170 | case KeyEvent.VK_O: | 170 | case KeyEvent.VK_O: |
| 171 | PanelEditor.this.popupMenu.toggleMappingMenu.doClick(); | 171 | EditorPanel.this.popupMenu.toggleMappingMenu.doClick(); |
| 172 | break; | 172 | break; |
| 173 | 173 | ||
| 174 | case KeyEvent.VK_R: | 174 | case KeyEvent.VK_R: |
| 175 | PanelEditor.this.popupMenu.renameMenu.doClick(); | 175 | EditorPanel.this.popupMenu.renameMenu.doClick(); |
| 176 | break; | 176 | break; |
| 177 | 177 | ||
| 178 | case KeyEvent.VK_D: | 178 | case KeyEvent.VK_D: |
| 179 | PanelEditor.this.popupMenu.editJavadocMenu.doClick(); | 179 | EditorPanel.this.popupMenu.editJavadocMenu.doClick(); |
| 180 | break; | 180 | break; |
| 181 | 181 | ||
| 182 | case KeyEvent.VK_F5: | 182 | case KeyEvent.VK_F5: |
| 183 | if (PanelEditor.this.classHandle != null) { | 183 | if (EditorPanel.this.classHandle != null) { |
| 184 | PanelEditor.this.classHandle.invalidateMapped(); | 184 | EditorPanel.this.classHandle.invalidateMapped(); |
| 185 | } | 185 | } |
| 186 | break; | 186 | break; |
| 187 | 187 | ||
| @@ -200,7 +200,7 @@ public class PanelEditor { | |||
| 200 | break; | 200 | break; |
| 201 | 201 | ||
| 202 | default: | 202 | default: |
| 203 | PanelEditor.this.shouldNavigateOnClick = true; // CTRL | 203 | EditorPanel.this.shouldNavigateOnClick = true; // CTRL |
| 204 | break; | 204 | break; |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| @@ -208,11 +208,11 @@ public class PanelEditor { | |||
| 208 | 208 | ||
| 209 | @Override | 209 | @Override |
| 210 | public void keyTyped(KeyEvent event) { | 210 | public void keyTyped(KeyEvent event) { |
| 211 | if (!PanelEditor.this.popupMenu.renameMenu.isEnabled()) return; | 211 | if (!EditorPanel.this.popupMenu.renameMenu.isEnabled()) return; |
| 212 | 212 | ||
| 213 | if (!event.isControlDown() && !event.isAltDown() && Character.isJavaIdentifierPart(event.getKeyChar())) { | 213 | if (!event.isControlDown() && !event.isAltDown() && Character.isJavaIdentifierPart(event.getKeyChar())) { |
| 214 | EnigmaProject project = gui.getController().project; | 214 | EnigmaProject project = gui.getController().project; |
| 215 | EntryReference<Entry<?>, Entry<?>> reference = project.getMapper().deobfuscate(PanelEditor.this.cursorReference); | 215 | EntryReference<Entry<?>, Entry<?>> reference = project.getMapper().deobfuscate(EditorPanel.this.cursorReference); |
| 216 | Entry<?> entry = reference.getNameableEntry(); | 216 | Entry<?> entry = reference.getNameableEntry(); |
| 217 | 217 | ||
| 218 | String name = String.valueOf(event.getKeyChar()); | 218 | String name = String.valueOf(event.getKeyChar()); |
| @@ -223,13 +223,13 @@ public class PanelEditor { | |||
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | gui.startRename(PanelEditor.this, name); | 226 | gui.startRename(EditorPanel.this, name); |
| 227 | } | 227 | } |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | @Override | 230 | @Override |
| 231 | public void keyReleased(KeyEvent event) { | 231 | public void keyReleased(KeyEvent event) { |
| 232 | PanelEditor.this.shouldNavigateOnClick = event.isControlDown(); | 232 | EditorPanel.this.shouldNavigateOnClick = event.isControlDown(); |
| 233 | } | 233 | } |
| 234 | }); | 234 | }); |
| 235 | 235 | ||
| @@ -248,15 +248,15 @@ public class PanelEditor { | |||
| 248 | this.boxHighlightPainters = boxHighlightPainters; | 248 | this.boxHighlightPainters = boxHighlightPainters; |
| 249 | }; | 249 | }; |
| 250 | 250 | ||
| 251 | this.ui.putClientProperty(PanelEditor.class, this); | 251 | this.ui.putClientProperty(EditorPanel.class, this); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | @Nullable | 254 | @Nullable |
| 255 | public static PanelEditor byUi(Component ui) { | 255 | public static EditorPanel byUi(Component ui) { |
| 256 | if (ui instanceof JComponent) { | 256 | if (ui instanceof JComponent) { |
| 257 | Object prop = ((JComponent) ui).getClientProperty(PanelEditor.class); | 257 | Object prop = ((JComponent) ui).getClientProperty(EditorPanel.class); |
| 258 | if (prop instanceof PanelEditor) { | 258 | if (prop instanceof EditorPanel) { |
| 259 | return (PanelEditor) prop; | 259 | return (EditorPanel) prop; |
| 260 | } | 260 | } |
| 261 | } | 261 | } |
| 262 | return null; | 262 | return null; |
| @@ -279,7 +279,7 @@ public class PanelEditor { | |||
| 279 | @Override | 279 | @Override |
| 280 | public void onDeobfRefChanged(ClassHandle h, ClassEntry deobfRef) { | 280 | public void onDeobfRefChanged(ClassHandle h, ClassEntry deobfRef) { |
| 281 | SwingUtilities.invokeLater(() -> { | 281 | SwingUtilities.invokeLater(() -> { |
| 282 | PanelEditor.this.listeners.forEach(l -> l.onTitleChanged(PanelEditor.this, getFileName())); | 282 | EditorPanel.this.listeners.forEach(l -> l.onTitleChanged(EditorPanel.this, getFileName())); |
| 283 | }); | 283 | }); |
| 284 | } | 284 | } |
| 285 | 285 | ||
| @@ -292,14 +292,14 @@ public class PanelEditor { | |||
| 292 | public void onInvalidate(ClassHandle h, InvalidationType t) { | 292 | public void onInvalidate(ClassHandle h, InvalidationType t) { |
| 293 | SwingUtilities.invokeLater(() -> { | 293 | SwingUtilities.invokeLater(() -> { |
| 294 | if (t == InvalidationType.FULL) { | 294 | if (t == InvalidationType.FULL) { |
| 295 | PanelEditor.this.setDisplayMode(DisplayMode.IN_PROGRESS); | 295 | EditorPanel.this.setDisplayMode(DisplayMode.IN_PROGRESS); |
| 296 | } | 296 | } |
| 297 | }); | 297 | }); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | @Override | 300 | @Override |
| 301 | public void onDeleted(ClassHandle h) { | 301 | public void onDeleted(ClassHandle h) { |
| 302 | SwingUtilities.invokeLater(() -> PanelEditor.this.gui.closeEditor(PanelEditor.this)); | 302 | SwingUtilities.invokeLater(() -> EditorPanel.this.gui.closeEditor(EditorPanel.this)); |
| 303 | } | 303 | } |
| 304 | }); | 304 | }); |
| 305 | 305 | ||
| @@ -610,12 +610,12 @@ public class PanelEditor { | |||
| 610 | public void actionPerformed(ActionEvent event) { | 610 | public void actionPerformed(ActionEvent event) { |
| 611 | if (this.counter % 2 == 0) { | 611 | if (this.counter % 2 == 0) { |
| 612 | try { | 612 | try { |
| 613 | this.highlight = PanelEditor.this.editor.getHighlighter().addHighlight(token.start, token.end, highlightPainter); | 613 | this.highlight = EditorPanel.this.editor.getHighlighter().addHighlight(token.start, token.end, highlightPainter); |
| 614 | } catch (BadLocationException ex) { | 614 | } catch (BadLocationException ex) { |
| 615 | // don't care | 615 | // don't care |
| 616 | } | 616 | } |
| 617 | } else if (this.highlight != null) { | 617 | } else if (this.highlight != null) { |
| 618 | PanelEditor.this.editor.getHighlighter().removeHighlight(this.highlight); | 618 | EditorPanel.this.editor.getHighlighter().removeHighlight(this.highlight); |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | if (this.counter++ > 6) { | 621 | if (this.counter++ > 6) { |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelIdentifier.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/IdentifierPanel.java index bfba8452..10f8eb5a 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelIdentifier.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/IdentifierPanel.java | |||
| @@ -23,7 +23,7 @@ import cuchaz.enigma.translation.representation.entry.*; | |||
| 23 | import cuchaz.enigma.utils.I18n; | 23 | import cuchaz.enigma.utils.I18n; |
| 24 | import cuchaz.enigma.utils.validation.ValidationContext; | 24 | import cuchaz.enigma.utils.validation.ValidationContext; |
| 25 | 25 | ||
| 26 | public class PanelIdentifier { | 26 | public class IdentifierPanel { |
| 27 | 27 | ||
| 28 | private final Gui gui; | 28 | private final Gui gui; |
| 29 | 29 | ||
| @@ -36,7 +36,7 @@ public class PanelIdentifier { | |||
| 36 | 36 | ||
| 37 | private final ValidationContext vc = new ValidationContext(); | 37 | private final ValidationContext vc = new ValidationContext(); |
| 38 | 38 | ||
| 39 | public PanelIdentifier(Gui gui) { | 39 | public IdentifierPanel(Gui gui) { |
| 40 | this.gui = gui; | 40 | this.gui = gui; |
| 41 | 41 | ||
| 42 | this.ui = new JPanel(); | 42 | this.ui = new JPanel(); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelObf.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/ObfPanel.java index dd7f9f97..0ca05837 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/PanelObf.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/ObfPanel.java | |||
| @@ -1,20 +1,23 @@ | |||
| 1 | package cuchaz.enigma.gui.panels; | 1 | package cuchaz.enigma.gui.panels; |
| 2 | 2 | ||
| 3 | import java.awt.BorderLayout; | ||
| 4 | import java.util.Comparator; | ||
| 5 | |||
| 6 | import javax.swing.JLabel; | ||
| 7 | import javax.swing.JPanel; | ||
| 8 | import javax.swing.JScrollPane; | ||
| 9 | |||
| 3 | import cuchaz.enigma.gui.ClassSelector; | 10 | import cuchaz.enigma.gui.ClassSelector; |
| 4 | import cuchaz.enigma.gui.Gui; | 11 | import cuchaz.enigma.gui.Gui; |
| 5 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 12 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 6 | import cuchaz.enigma.utils.I18n; | 13 | import cuchaz.enigma.utils.I18n; |
| 7 | 14 | ||
| 8 | import javax.swing.*; | 15 | public class ObfPanel extends JPanel { |
| 9 | import java.awt.*; | ||
| 10 | import java.util.Comparator; | ||
| 11 | |||
| 12 | public class PanelObf extends JPanel { | ||
| 13 | 16 | ||
| 14 | public final ClassSelector obfClasses; | 17 | public final ClassSelector obfClasses; |
| 15 | private final Gui gui; | 18 | private final Gui gui; |
| 16 | 19 | ||
| 17 | public PanelObf(Gui gui) { | 20 | public ObfPanel(Gui gui) { |
| 18 | this.gui = gui; | 21 | this.gui = gui; |
| 19 | 22 | ||
| 20 | Comparator<ClassEntry> obfClassComparator = (a, b) -> { | 23 | Comparator<ClassEntry> obfClassComparator = (a, b) -> { |