diff options
| author | 2014-08-10 01:03:40 -0400 | |
|---|---|---|
| committer | 2014-08-10 01:03:40 -0400 | |
| commit | d24d2b9ad9b5c895020b56f700a72906346482e5 (patch) | |
| tree | da360c07209e6e327325db53dbb4df05e77cb7e9 /src/cuchaz/enigma/gui/Gui.java | |
| parent | added sorting for deobfuscated classes (diff) | |
| download | enigma-fork-d24d2b9ad9b5c895020b56f700a72906346482e5.tar.gz enigma-fork-d24d2b9ad9b5c895020b56f700a72906346482e5.tar.xz enigma-fork-d24d2b9ad9b5c895020b56f700a72906346482e5.zip | |
completely re-wrote token recognizer to bootstrap from Procyon's AST
changed imports to guava instead of whatever collections library happened to be on my classpath
Diffstat (limited to 'src/cuchaz/enigma/gui/Gui.java')
| -rw-r--r-- | src/cuchaz/enigma/gui/Gui.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java index 61e66e0..187852a 100644 --- a/src/cuchaz/enigma/gui/Gui.java +++ b/src/cuchaz/enigma/gui/Gui.java | |||
| @@ -62,12 +62,12 @@ import javax.swing.tree.TreePath; | |||
| 62 | 62 | ||
| 63 | import jsyntaxpane.DefaultSyntaxKit; | 63 | import jsyntaxpane.DefaultSyntaxKit; |
| 64 | import jsyntaxpane.SyntaxDocument; | 64 | import jsyntaxpane.SyntaxDocument; |
| 65 | import jsyntaxpane.Token; | ||
| 66 | 65 | ||
| 67 | import com.beust.jcommander.internal.Lists; | 66 | import com.google.common.collect.Lists; |
| 68 | 67 | ||
| 69 | import cuchaz.enigma.ClassFile; | 68 | import cuchaz.enigma.ClassFile; |
| 70 | import cuchaz.enigma.Constants; | 69 | import cuchaz.enigma.Constants; |
| 70 | import cuchaz.enigma.analysis.Token; | ||
| 71 | import cuchaz.enigma.mapping.ArgumentEntry; | 71 | import cuchaz.enigma.mapping.ArgumentEntry; |
| 72 | import cuchaz.enigma.mapping.ClassEntry; | 72 | import cuchaz.enigma.mapping.ClassEntry; |
| 73 | import cuchaz.enigma.mapping.Entry; | 73 | import cuchaz.enigma.mapping.Entry; |
| @@ -643,7 +643,7 @@ public class Gui | |||
| 643 | { | 643 | { |
| 644 | try | 644 | try |
| 645 | { | 645 | { |
| 646 | m_editor.getHighlighter().addHighlight( token.start, token.end(), painter ); | 646 | m_editor.getHighlighter().addHighlight( token.start, token.end, painter ); |
| 647 | } | 647 | } |
| 648 | catch( BadLocationException ex ) | 648 | catch( BadLocationException ex ) |
| 649 | { | 649 | { |
| @@ -740,22 +740,20 @@ public class Gui | |||
| 740 | 740 | ||
| 741 | private void onCaretMove( int pos ) | 741 | private void onCaretMove( int pos ) |
| 742 | { | 742 | { |
| 743 | m_selectedEntryPair = m_controller.getEntryPair( pos ); | 743 | Token token = m_controller.getToken( pos ); |
| 744 | 744 | m_renameMenu.setEnabled( token != null ); | |
| 745 | boolean isEntry = m_selectedEntryPair != null; | 745 | if( token == null ) |
| 746 | boolean isClassEntry = isEntry && m_selectedEntryPair.obf instanceof ClassEntry; | ||
| 747 | boolean isMethodEntry = isEntry && m_selectedEntryPair.obf instanceof MethodEntry; | ||
| 748 | |||
| 749 | if( isEntry ) | ||
| 750 | { | ||
| 751 | showEntryPair( m_selectedEntryPair ); | ||
| 752 | } | ||
| 753 | else | ||
| 754 | { | 746 | { |
| 755 | clearEntryPair(); | 747 | clearEntryPair(); |
| 748 | return; | ||
| 756 | } | 749 | } |
| 757 | 750 | ||
| 758 | m_renameMenu.setEnabled( isEntry ); | 751 | m_selectedEntryPair = m_controller.getEntryPair( token ); |
| 752 | boolean isClassEntry = m_selectedEntryPair.obf instanceof ClassEntry; | ||
| 753 | boolean isMethodEntry = m_selectedEntryPair.obf instanceof MethodEntry; | ||
| 754 | |||
| 755 | showEntryPair( m_selectedEntryPair ); | ||
| 756 | |||
| 759 | m_inheritanceMenu.setEnabled( isClassEntry || isMethodEntry ); | 757 | m_inheritanceMenu.setEnabled( isClassEntry || isMethodEntry ); |
| 760 | m_openEntryMenu.setEnabled( isClassEntry ); | 758 | m_openEntryMenu.setEnabled( isClassEntry ); |
| 761 | } | 759 | } |
| @@ -803,6 +801,7 @@ public class Gui | |||
| 803 | int lineNum = doc.getLineNumberAt( m_editor.getCaretPosition() ); | 801 | int lineNum = doc.getLineNumberAt( m_editor.getCaretPosition() ); |
| 804 | try | 802 | try |
| 805 | { | 803 | { |
| 804 | // TODO: give token to the controller so we can put the caret back there | ||
| 806 | m_controller.rename( m_selectedEntryPair.obf, newName, lineNum ); | 805 | m_controller.rename( m_selectedEntryPair.obf, newName, lineNum ); |
| 807 | } | 806 | } |
| 808 | catch( IllegalNameException ex ) | 807 | catch( IllegalNameException ex ) |