From ba7a354efae7d49833c887cf147ac940c975a1fa Mon Sep 17 00:00:00 2001 From: Gegy Date: Wed, 30 Jan 2019 21:05:32 +0200 Subject: Remap sources (#106) * Source remapping beginnings * Fix navigation to remapped classes * Translate identifier info reference * Remap local variables with default names in source * Caching translator * Fix lack of highlighting for first opened class * Fix unicode variable names * Unicode checker shouldn't be checking just alphanumeric * Fix package tree being built from obf names * Don't index `this` as method call for method::reference * Apply proposed names * Fix source export issues * Replace unicode var names at bytecode level uniquely * Drop imports from editor source * Class selector fixes * Delta keep track of base mappings to enable lookup of old names * Optimize source remapping by remapping source with a StringBuffer instead of copying * Bump version --- src/main/java/cuchaz/enigma/config/Themes.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/main/java/cuchaz/enigma/config/Themes.java') diff --git a/src/main/java/cuchaz/enigma/config/Themes.java b/src/main/java/cuchaz/enigma/config/Themes.java index 00324f4..400ea3f 100644 --- a/src/main/java/cuchaz/enigma/config/Themes.java +++ b/src/main/java/cuchaz/enigma/config/Themes.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap; import cuchaz.enigma.gui.Gui; import cuchaz.enigma.gui.EnigmaSyntaxKit; import cuchaz.enigma.gui.highlight.BoxHighlightPainter; +import cuchaz.enigma.gui.highlight.TokenHighlightType; import de.sciss.syntaxpane.DefaultSyntaxKit; import javax.swing.*; @@ -17,10 +18,11 @@ public class Themes { } public static void updateTheme(Gui gui) { - Config.getInstance().lookAndFeel.apply(Config.getInstance()); - Config.getInstance().lookAndFeel.setGlobalLAF(); + Config config = Config.getInstance(); + config.lookAndFeel.apply(config); + config.lookAndFeel.setGlobalLAF(); try { - Config.getInstance().saveConfig(); + config.saveConfig(); } catch (IOException e) { e.printStackTrace(); } @@ -28,12 +30,11 @@ public class Themes { DefaultSyntaxKit.initKit(); DefaultSyntaxKit.registerContentType("text/enigma-sources", EnigmaSyntaxKit.class.getName()); gui.boxHighlightPainters = ImmutableMap.of( - "obfuscated", BoxHighlightPainter.create(Config.getInstance().obfuscatedColor, Config.getInstance().obfuscatedColorOutline), - "proposed", BoxHighlightPainter.create(Config.getInstance().proposedColor, Config.getInstance().proposedColorOutline), - "deobfuscated", BoxHighlightPainter.create(Config.getInstance().deobfuscatedColor, Config.getInstance().deobfuscatedColorOutline), - "other", BoxHighlightPainter.create(null, Config.getInstance().otherColorOutline) + TokenHighlightType.OBFUSCATED, BoxHighlightPainter.create(config.obfuscatedColor, config.obfuscatedColorOutline), + TokenHighlightType.PROPOSED, BoxHighlightPainter.create(config.proposedColor, config.proposedColorOutline), + TokenHighlightType.DEOBFUSCATED, BoxHighlightPainter.create(config.deobfuscatedColor, config.deobfuscatedColorOutline) ); - gui.setEditorTheme(Config.getInstance().lookAndFeel); + gui.setEditorTheme(config.lookAndFeel); SwingUtilities.updateComponentTreeUI(gui.getFrame()); } } -- cgit v1.2.3