diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java index 4ffd6c71..22e568cd 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java @@ -25,21 +25,20 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import com.formdev.flatlaf.json.Json; import com.formdev.flatlaf.util.StringUtils; /** * @author Karl Tauber */ -public class IJThemesManager +class IJThemesManager { final List bundledThemes = new ArrayList<>(); final List moreThemes = new ArrayList<>(); private final Map lastModifiedMap = new HashMap<>(); @SuppressWarnings( "unchecked" ) - public void loadBundledThemes() { + void loadBundledThemes() { bundledThemes.clear(); // load themes.json @@ -96,10 +95,4 @@ public class IJThemesManager } return false; } - - public List getBundledResourceNames() { - return bundledThemes.stream() - .map( themeInfo -> themeInfo.resourceName ) - .collect( Collectors.toList() ); - } } diff --git a/flatlaf-testing/build.gradle.kts b/flatlaf-testing/build.gradle.kts index 1bfca1c5..a820e7cf 100644 --- a/flatlaf-testing/build.gradle.kts +++ b/flatlaf-testing/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { implementation( project( ":flatlaf-extras" ) ) implementation( project( ":flatlaf-swingx" ) ) implementation( project( ":flatlaf-jide-oss" ) ) + implementation( project( ":flatlaf-intellij-themes" ) ) implementation( project( ":flatlaf-demo" ) ) implementation( "com.miglayout:miglayout-swing:5.2" ) diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java index ef4813a8..af6c8bc7 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java @@ -43,6 +43,7 @@ import javax.swing.UIDefaults; import javax.swing.UIDefaults.ActiveValue; import javax.swing.UIDefaults.LazyValue; import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.LineBorder; @@ -50,8 +51,7 @@ import javax.swing.plaf.BorderUIResource; import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicLookAndFeel; import com.formdev.flatlaf.*; -import com.formdev.flatlaf.demo.intellijthemes.IJThemesManager; -import com.formdev.flatlaf.demo.intellijthemes.IJThemesPanel; +import com.formdev.flatlaf.intellijthemes.FlatAllIJThemes; import com.formdev.flatlaf.util.StringUtils; import com.formdev.flatlaf.util.SystemInfo; @@ -108,15 +108,15 @@ public class UIDefaultsDump private static void dumpIntelliJThemes( File dir ) { dir = new File( dir, "intellijthemes" ); - IJThemesManager themesManager = new IJThemesManager(); - themesManager.loadBundledThemes(); + for( LookAndFeelInfo info : FlatAllIJThemes.INFOS ) { + String lafClassName = info.getClassName(); + String relativeLafClassName = StringUtils.removeLeading( lafClassName, "com.formdev.flatlaf.intellijthemes." ); + File dir2 = relativeLafClassName.lastIndexOf( '.' ) >= 0 + ? new File( dir, relativeLafClassName.substring( 0, relativeLafClassName.lastIndexOf( '.' ) ).replace( '.', '/' ) ) + : dir; - for( String resourceName : themesManager.getBundledResourceNames() ) { - IntelliJTheme.install( UIDefaultsDump.class.getResourceAsStream( - IJThemesPanel.THEMES_PACKAGE + resourceName ) ); - dump( dir, StringUtils.removeTrailing( resourceName, ".theme.json" ) ); + dump( lafClassName, dir2 ); } - } private static void dump( String lookAndFeelClassName, File dir ) {