mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
UIDefaultsDump: used FlatAllIJThemes instead of IJThemesManager to get list of IJ themes
This commit is contained in:
@@ -25,21 +25,20 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import com.formdev.flatlaf.json.Json;
|
import com.formdev.flatlaf.json.Json;
|
||||||
import com.formdev.flatlaf.util.StringUtils;
|
import com.formdev.flatlaf.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
*/
|
*/
|
||||||
public class IJThemesManager
|
class IJThemesManager
|
||||||
{
|
{
|
||||||
final List<IJThemeInfo> bundledThemes = new ArrayList<>();
|
final List<IJThemeInfo> bundledThemes = new ArrayList<>();
|
||||||
final List<IJThemeInfo> moreThemes = new ArrayList<>();
|
final List<IJThemeInfo> moreThemes = new ArrayList<>();
|
||||||
private final Map<File,Long> lastModifiedMap = new HashMap<>();
|
private final Map<File,Long> lastModifiedMap = new HashMap<>();
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
public void loadBundledThemes() {
|
void loadBundledThemes() {
|
||||||
bundledThemes.clear();
|
bundledThemes.clear();
|
||||||
|
|
||||||
// load themes.json
|
// load themes.json
|
||||||
@@ -96,10 +95,4 @@ public class IJThemesManager
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getBundledResourceNames() {
|
|
||||||
return bundledThemes.stream()
|
|
||||||
.map( themeInfo -> themeInfo.resourceName )
|
|
||||||
.collect( Collectors.toList() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ dependencies {
|
|||||||
implementation( project( ":flatlaf-extras" ) )
|
implementation( project( ":flatlaf-extras" ) )
|
||||||
implementation( project( ":flatlaf-swingx" ) )
|
implementation( project( ":flatlaf-swingx" ) )
|
||||||
implementation( project( ":flatlaf-jide-oss" ) )
|
implementation( project( ":flatlaf-jide-oss" ) )
|
||||||
|
implementation( project( ":flatlaf-intellij-themes" ) )
|
||||||
implementation( project( ":flatlaf-demo" ) )
|
implementation( project( ":flatlaf-demo" ) )
|
||||||
|
|
||||||
implementation( "com.miglayout:miglayout-swing:5.2" )
|
implementation( "com.miglayout:miglayout-swing:5.2" )
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import javax.swing.UIDefaults;
|
|||||||
import javax.swing.UIDefaults.ActiveValue;
|
import javax.swing.UIDefaults.ActiveValue;
|
||||||
import javax.swing.UIDefaults.LazyValue;
|
import javax.swing.UIDefaults.LazyValue;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.UIManager.LookAndFeelInfo;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.CompoundBorder;
|
import javax.swing.border.CompoundBorder;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
@@ -50,8 +51,7 @@ import javax.swing.plaf.BorderUIResource;
|
|||||||
import javax.swing.plaf.UIResource;
|
import javax.swing.plaf.UIResource;
|
||||||
import javax.swing.plaf.basic.BasicLookAndFeel;
|
import javax.swing.plaf.basic.BasicLookAndFeel;
|
||||||
import com.formdev.flatlaf.*;
|
import com.formdev.flatlaf.*;
|
||||||
import com.formdev.flatlaf.demo.intellijthemes.IJThemesManager;
|
import com.formdev.flatlaf.intellijthemes.FlatAllIJThemes;
|
||||||
import com.formdev.flatlaf.demo.intellijthemes.IJThemesPanel;
|
|
||||||
import com.formdev.flatlaf.util.StringUtils;
|
import com.formdev.flatlaf.util.StringUtils;
|
||||||
import com.formdev.flatlaf.util.SystemInfo;
|
import com.formdev.flatlaf.util.SystemInfo;
|
||||||
|
|
||||||
@@ -108,15 +108,15 @@ public class UIDefaultsDump
|
|||||||
private static void dumpIntelliJThemes( File dir ) {
|
private static void dumpIntelliJThemes( File dir ) {
|
||||||
dir = new File( dir, "intellijthemes" );
|
dir = new File( dir, "intellijthemes" );
|
||||||
|
|
||||||
IJThemesManager themesManager = new IJThemesManager();
|
for( LookAndFeelInfo info : FlatAllIJThemes.INFOS ) {
|
||||||
themesManager.loadBundledThemes();
|
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() ) {
|
dump( lafClassName, dir2 );
|
||||||
IntelliJTheme.install( UIDefaultsDump.class.getResourceAsStream(
|
|
||||||
IJThemesPanel.THEMES_PACKAGE + resourceName ) );
|
|
||||||
dump( dir, StringUtils.removeTrailing( resourceName, ".theme.json" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void dump( String lookAndFeelClassName, File dir ) {
|
private static void dump( String lookAndFeelClassName, File dir ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user