mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
IntelliJ Themes: moved themes into own sub-project and build a JAR that contains all themes
This commit is contained in:
@@ -30,6 +30,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation( project( ":flatlaf-core" ) )
|
implementation( project( ":flatlaf-core" ) )
|
||||||
implementation( project( ":flatlaf-extras" ) )
|
implementation( project( ":flatlaf-extras" ) )
|
||||||
|
implementation( project( ":flatlaf-intellij-themes" ) )
|
||||||
implementation( "com.miglayout:miglayout-swing:5.2" )
|
implementation( "com.miglayout:miglayout-swing:5.2" )
|
||||||
implementation( "com.jgoodies:jgoodies-forms:1.9.0" )
|
implementation( "com.jgoodies:jgoodies-forms:1.9.0" )
|
||||||
}
|
}
|
||||||
@@ -38,6 +39,7 @@ tasks {
|
|||||||
jar {
|
jar {
|
||||||
dependsOn( ":flatlaf-core:jar" )
|
dependsOn( ":flatlaf-core:jar" )
|
||||||
dependsOn( ":flatlaf-extras:jar" )
|
dependsOn( ":flatlaf-extras:jar" )
|
||||||
|
dependsOn( ":flatlaf-intellij-themes:jar" )
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes( "Main-Class" to "com.formdev.flatlaf.demo.FlatLafDemo" )
|
attributes( "Main-Class" to "com.formdev.flatlaf.demo.FlatLafDemo" )
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class DemoPrefs
|
|||||||
if( IntelliJTheme.ThemeLaf.class.getName().equals( lafClassName ) ) {
|
if( IntelliJTheme.ThemeLaf.class.getName().equals( lafClassName ) ) {
|
||||||
String theme = state.get( KEY_LAF_THEME, "" );
|
String theme = state.get( KEY_LAF_THEME, "" );
|
||||||
if( theme.startsWith( RESOURCE_PREFIX ) )
|
if( theme.startsWith( RESOURCE_PREFIX ) )
|
||||||
IntelliJTheme.install( IJThemesPanel.class.getResourceAsStream( theme.substring( RESOURCE_PREFIX.length() ) ) );
|
IntelliJTheme.install( IJThemesPanel.class.getResourceAsStream( IJThemesPanel.THEMES_PACKAGE + theme.substring( RESOURCE_PREFIX.length() ) ) );
|
||||||
else if( theme.startsWith( FILE_PREFIX ) )
|
else if( theme.startsWith( FILE_PREFIX ) )
|
||||||
FlatLaf.install( IntelliJTheme.createLaf( new FileInputStream( theme.substring( FILE_PREFIX.length() ) ) ) );
|
FlatLaf.install( IntelliJTheme.createLaf( new FileInputStream( theme.substring( FILE_PREFIX.length() ) ) ) );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ import net.miginfocom.swing.*;
|
|||||||
public class IJThemesPanel
|
public class IJThemesPanel
|
||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
|
public static final String THEMES_PACKAGE = "/com/formdev/flatlaf/intellijthemes/themes/";
|
||||||
|
|
||||||
private final IJThemesManager themesManager = new IJThemesManager();
|
private final IJThemesManager themesManager = new IJThemesManager();
|
||||||
private final List<IJThemeInfo> themes = new ArrayList<>();
|
private final List<IJThemeInfo> themes = new ArrayList<>();
|
||||||
private final HashMap<Integer, String> categories = new HashMap<>();
|
private final HashMap<Integer, String> categories = new HashMap<>();
|
||||||
@@ -237,7 +239,7 @@ public class IJThemesPanel
|
|||||||
showInformationDialog( "Failed to load '" + themeInfo.themeFile + "'.", ex );
|
showInformationDialog( "Failed to load '" + themeInfo.themeFile + "'.", ex );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IntelliJTheme.install( getClass().getResourceAsStream( themeInfo.resourceName ) );
|
IntelliJTheme.install( getClass().getResourceAsStream( THEMES_PACKAGE + themeInfo.resourceName ) );
|
||||||
DemoPrefs.getState().put( DemoPrefs.KEY_LAF_THEME, DemoPrefs.RESOURCE_PREFIX + themeInfo.resourceName );
|
DemoPrefs.getState().put( DemoPrefs.KEY_LAF_THEME, DemoPrefs.RESOURCE_PREFIX + themeInfo.resourceName );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +262,7 @@ public class IJThemesPanel
|
|||||||
|
|
||||||
// save theme
|
// save theme
|
||||||
try {
|
try {
|
||||||
Files.copy( getClass().getResourceAsStream( themeInfo.resourceName ),
|
Files.copy( getClass().getResourceAsStream( THEMES_PACKAGE + themeInfo.resourceName ),
|
||||||
file.toPath(), StandardCopyOption.REPLACE_EXISTING );
|
file.toPath(), StandardCopyOption.REPLACE_EXISTING );
|
||||||
} catch( IOException ex ) {
|
} catch( IOException ex ) {
|
||||||
showInformationDialog( "Failed to save theme to '" + file + "'.", ex );
|
showInformationDialog( "Failed to save theme to '" + file + "'.", ex );
|
||||||
@@ -273,7 +275,7 @@ public class IJThemesPanel
|
|||||||
File licenseFile = new File( file.getParentFile(),
|
File licenseFile = new File( file.getParentFile(),
|
||||||
StringUtils.removeTrailing( file.getName(), ".theme.json" ) +
|
StringUtils.removeTrailing( file.getName(), ".theme.json" ) +
|
||||||
themeInfo.licenseFile.substring( themeInfo.licenseFile.indexOf( '.' ) ) );
|
themeInfo.licenseFile.substring( themeInfo.licenseFile.indexOf( '.' ) ) );
|
||||||
Files.copy( getClass().getResourceAsStream( themeInfo.licenseFile ),
|
Files.copy( getClass().getResourceAsStream( THEMES_PACKAGE + themeInfo.licenseFile ),
|
||||||
licenseFile.toPath(), StandardCopyOption.REPLACE_EXISTING );
|
licenseFile.toPath(), StandardCopyOption.REPLACE_EXISTING );
|
||||||
} catch( IOException ex ) {
|
} catch( IOException ex ) {
|
||||||
showInformationDialog( "Failed to save theme license to '" + file + "'.", ex );
|
showInformationDialog( "Failed to save theme license to '" + file + "'.", ex );
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class IJThemesUpdater
|
|||||||
else if( fromUrl.contains( "gitlab.com" ) )
|
else if( fromUrl.contains( "gitlab.com" ) )
|
||||||
fromUrl = fromUrl.replace( "/blob/", "/raw/" );
|
fromUrl = fromUrl.replace( "/blob/", "/raw/" );
|
||||||
|
|
||||||
String toPath = "src/main/resources/com/formdev/flatlaf/demo/intellijthemes/" + ti.resourceName;
|
String toPath = "../flatlaf-intellij-themes/src/main/resources" + IJThemesPanel.THEMES_PACKAGE + ti.resourceName;
|
||||||
|
|
||||||
download( fromUrl, toPath );
|
download( fromUrl, toPath );
|
||||||
}
|
}
|
||||||
|
|||||||
137
flatlaf-intellij-themes/build.gradle.kts
Normal file
137
flatlaf-intellij-themes/build.gradle.kts
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020 FormDev Software GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
|
id( "com.jfrog.bintray" )
|
||||||
|
id( "com.jfrog.artifactory" )
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation( project( ":flatlaf-core" ) )
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
assemble {
|
||||||
|
dependsOn(
|
||||||
|
"sourcesJar",
|
||||||
|
"javadocJar"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
options {
|
||||||
|
this as StandardJavadocDocletOptions
|
||||||
|
tags = listOf( "uiDefault", "clientProperty" )
|
||||||
|
}
|
||||||
|
isFailOnError = false
|
||||||
|
}
|
||||||
|
|
||||||
|
register( "sourcesJar", Jar::class ) {
|
||||||
|
archiveClassifier.set( "sources" )
|
||||||
|
|
||||||
|
from( sourceSets.main.get().allJava )
|
||||||
|
}
|
||||||
|
|
||||||
|
register( "javadocJar", Jar::class ) {
|
||||||
|
archiveClassifier.set( "javadoc" )
|
||||||
|
|
||||||
|
from( javadoc )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>( "maven" ) {
|
||||||
|
artifactId = "flatlaf-intellij-themes"
|
||||||
|
groupId = "com.formdev"
|
||||||
|
|
||||||
|
from( components["java"] )
|
||||||
|
|
||||||
|
artifact( tasks["sourcesJar"] )
|
||||||
|
artifact( tasks["javadocJar"] )
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name.set( "FlatLaf IntelliJ Themes Pack" )
|
||||||
|
description.set( "Flat Look and Feel IntelliJ Themes Pack" )
|
||||||
|
url.set( "https://github.com/JFormDesigner/FlatLaf" )
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name.set( "The Apache License, Version 2.0" )
|
||||||
|
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
name.set( "Karl Tauber" )
|
||||||
|
organization.set( "FormDev Software GmbH" )
|
||||||
|
organizationUrl.set( "https://www.formdev.com/" )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scm {
|
||||||
|
url.set( "https://github.com/JFormDesigner/FlatLaf" )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bintray {
|
||||||
|
user = rootProject.extra["bintray.user"] as String?
|
||||||
|
key = rootProject.extra["bintray.key"] as String?
|
||||||
|
|
||||||
|
setPublications( "maven" )
|
||||||
|
|
||||||
|
with( pkg ) {
|
||||||
|
repo = "flatlaf"
|
||||||
|
name = "flatlaf-intellij-themes"
|
||||||
|
setLicenses( "Apache-2.0" )
|
||||||
|
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
|
||||||
|
|
||||||
|
with( version ) {
|
||||||
|
name = project.version.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
publish = rootProject.extra["bintray.publish"] as Boolean
|
||||||
|
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
artifactory {
|
||||||
|
setContextUrl( "https://oss.jfrog.org" )
|
||||||
|
|
||||||
|
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
|
||||||
|
repository( delegateClosureOf<groovy.lang.GroovyObject> {
|
||||||
|
setProperty( "repoKey", "oss-snapshot-local" )
|
||||||
|
setProperty( "username", rootProject.extra["bintray.user"] as String? )
|
||||||
|
setProperty( "password", rootProject.extra["bintray.key"] as String? )
|
||||||
|
} )
|
||||||
|
|
||||||
|
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
|
||||||
|
invokeMethod( "publications", "maven" )
|
||||||
|
setProperty( "publishArtifacts", true )
|
||||||
|
setProperty( "publishPom", true )
|
||||||
|
} )
|
||||||
|
} )
|
||||||
|
|
||||||
|
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
|
||||||
|
setProperty( "repoKey", "jcenter" )
|
||||||
|
} )
|
||||||
|
}
|
||||||
@@ -51,6 +51,7 @@ 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.demo.intellijthemes.IJThemesManager;
|
||||||
|
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;
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ public class UIDefaultsDump
|
|||||||
|
|
||||||
for( String resourceName : themesManager.getBundledResourceNames() ) {
|
for( String resourceName : themesManager.getBundledResourceNames() ) {
|
||||||
IntelliJTheme.install( UIDefaultsDump.class.getResourceAsStream(
|
IntelliJTheme.install( UIDefaultsDump.class.getResourceAsStream(
|
||||||
"/com/formdev/flatlaf/demo/intellijthemes/" + resourceName ) );
|
IJThemesPanel.THEMES_PACKAGE + resourceName ) );
|
||||||
dump( dir, StringUtils.removeTrailing( resourceName, ".theme.json" ) );
|
dump( dir, StringUtils.removeTrailing( resourceName, ".theme.json" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ include( "flatlaf-core" )
|
|||||||
include( "flatlaf-extras" )
|
include( "flatlaf-extras" )
|
||||||
include( "flatlaf-swingx" )
|
include( "flatlaf-swingx" )
|
||||||
include( "flatlaf-jide-oss" )
|
include( "flatlaf-jide-oss" )
|
||||||
|
include( "flatlaf-intellij-themes" )
|
||||||
include( "flatlaf-demo" )
|
include( "flatlaf-demo" )
|
||||||
include( "flatlaf-testing" )
|
include( "flatlaf-testing" )
|
||||||
include( "flatlaf-theme-editor" )
|
include( "flatlaf-theme-editor" )
|
||||||
|
|||||||
Reference in New Issue
Block a user