Skip to content

Commit

Permalink
Fix v2021_2 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreyD97 committed Feb 9, 2021
1 parent 6befbc9 commit 7b83953
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/coreyd97/burpcustomizer/BurpCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
originalBurpTheme = UIManager.getLookAndFeel();

String sourceEnum = callbacks.loadExtensionSetting("source");
if(sourceEnum.equalsIgnoreCase("")){
if(sourceEnum == null || sourceEnum.equalsIgnoreCase("")){
themeSource = ThemeSource.BUILTIN;
}else {
themeSource = ThemeSource.valueOf(sourceEnum);
Expand All @@ -55,7 +55,7 @@ public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
if(previousTheme.isPresent()) selectedBuiltIn = previousTheme.get();

String themeFilePref = callbacks.loadExtensionSetting("themeFile");
if(!themeFilePref.equalsIgnoreCase("")){
if(themeFilePref != null && !themeFilePref.equalsIgnoreCase("")){
selectedThemeFile = new File(themeFilePref);
if(!selectedThemeFile.exists()) selectedThemeFile = null;
}
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/com/coreyd97/burpcustomizer/CustomTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

public class CustomTheme extends IntelliJTheme.ThemeLaf {

Class burpDark, burpLight;
Class burpLaf, burpDark, burpLight;

public CustomTheme(IntelliJTheme.ThemeLaf base) {
super(base.getTheme());
try {
this.burpLaf = ClassLoader.getSystemClassLoader().loadClass("burp.theme.BurpLaf");
this.burpDark = ClassLoader.getSystemClassLoader().loadClass("burp.theme.BurpDarkLaf");
this.burpLight = ClassLoader.getSystemClassLoader().loadClass("burp.theme.BurpLightLaf");
}catch (Exception e){
Expand All @@ -37,12 +38,14 @@ public UIDefaults getDefaults() {
defaults = super.getDefaults();
BurpCustomizer.callbacks.printError("Could not get Burp base theme! - " + e.getMessage());
}
// defaults = super.getDefaults(); //Debugging. Uncomment to overwrite all Burp defaults.
defaults.putAll(super.getDefaults());

UIDefaults superDefaults = super.getDefaults();
superDefaults.remove("SplitPaneUI"); //Do not remove Burp's UI delegates.
superDefaults.remove("TabbedPaneUI");
defaults.putAll(superDefaults);

//For some reason, using lazy loading in getAdditionalDefaults for this property causes issues...
defaults.put("TabbedPane.selectedBackground", defaults.get("TabbedPane.background"));

return defaults;
}

Expand Down

0 comments on commit 7b83953

Please sign in to comment.