Merge main into system-file-chooser

This commit is contained in:
Karl Tauber
2025-03-09 19:20:54 +01:00
170 changed files with 18264 additions and 5666 deletions

View File

@@ -1,4 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf;
import java.util.Collections;
import java.util.Properties;
import java.util.function.Function;
import com.formdev.flatlaf.UIDefaultsLoader.ValueType;
@@ -72,4 +73,8 @@ public class UIDefaultsLoaderAccessor
{
return UIDefaultsLoader.parseColorRGBA( value );
}
public static Properties newUIProperties( boolean dark ) {
return UIDefaultsLoader.newUIProperties( dark );
}
}

View File

@@ -41,6 +41,7 @@ import org.fife.ui.autocomplete.ParameterChoicesProvider;
import org.fife.ui.autocomplete.ParameterizedCompletion;
import org.fife.ui.autocomplete.ParameterizedCompletion.Parameter;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.formdev.flatlaf.FlatLaf;
/**
* @author Karl Tauber
@@ -358,12 +359,18 @@ class FlatCompletionProvider
lastKeys = keys;
completions.clear();
outer:
for( String key : keys ) {
if( key.startsWith( "[" ) ) {
while( key.startsWith( "[" ) ) {
// remove prefix
int closeIndex = key.indexOf( ']' );
if( closeIndex < 0 )
continue;
continue outer;
String prefix = key.substring( 0, closeIndex + 1 );
if( FlatLaf.getUIKeySpecialPrefixes().contains( prefix ) )
continue outer; // can not reference properties with special prefix
key = key.substring( closeIndex + 1 );
}

View File

@@ -76,14 +76,21 @@ class FlatThemePropertiesBaseManager
definedCoreKeys = new HashSet<>();
for( Properties properties : coreThemes.values() ) {
outer:
for( Object k : properties.keySet() ) {
String key = (String) k;
if( key.startsWith( "*." ) || key.startsWith( "@" ) )
continue;
if( key.startsWith( "[" ) ) {
while( key.startsWith( "[" ) ) {
int closeIndex = key.indexOf( ']' );
if( closeIndex < 0 )
continue;
continue outer;
String prefix = key.substring( 0, closeIndex + 1 );
if( FlatLaf.getUIKeySpecialPrefixes().contains( prefix ) )
break; // keep special prefix
key = key.substring( closeIndex + 1 );
}
definedCoreKeys.add( key );

View File

@@ -33,7 +33,6 @@ import javax.swing.event.DocumentListener;
import javax.swing.plaf.basic.BasicLookAndFeel;
import javax.swing.text.BadLocationException;
import com.formdev.flatlaf.UIDefaultsLoaderAccessor;
import com.formdev.flatlaf.util.SystemInfo;
/**
* Supports parsing content of text area in FlatLaf properties syntax.
@@ -54,17 +53,13 @@ class FlatThemePropertiesSupport
private final Map<String, Object> parsedValueCache2 = new HashMap<>();
private Set<String> allKeysCache;
private String baseTheme;
private boolean lastDark;
private static long globalCacheInvalidationCounter;
private long cacheInvalidationCounter;
private static Set<String> wildcardKeys;
private static final String platformPrefix =
SystemInfo.isWindows ? "[win]" :
SystemInfo.isMacOS ? "[mac]" :
SystemInfo.isLinux ? "[linux]" : "[unknown]";
FlatThemePropertiesSupport( FlatSyntaxTextArea textArea ) {
this.textArea = textArea;
@@ -115,6 +110,7 @@ class FlatThemePropertiesSupport
private KeyValue getKeyValueAtLine( int line ) {
try {
// get text at line
int startOffset = textArea.getLineStartOffset( line );
int endOffset = textArea.getLineEndOffset( line );
String text = textArea.getText( startOffset, endOffset - startOffset );
@@ -134,11 +130,13 @@ class FlatThemePropertiesSupport
text = text.substring( sepIndex + 1 );
}
// parse line
Properties properties = new Properties();
properties.load( new StringReader( text ) );
if( properties.isEmpty() )
return null;
// get key and value for line
String key = (String) properties.keys().nextElement();
String value = properties.getProperty( key );
return new KeyValue( key, value );
@@ -171,17 +169,7 @@ class FlatThemePropertiesSupport
}
private String getPropertyOrWildcard( String key ) {
// get platform specific properties
String value = getProperty( platformPrefix + key );
if( value != null )
return value;
// get light/dark specific properties
value = getProperty( (isDark( getBaseTheme() ) ? "[dark]" : "[light]") + key );
if( value != null )
return value;
value = getProperty( key );
String value = getProperty( key );
if( value != null )
return value;
@@ -213,9 +201,18 @@ class FlatThemePropertiesSupport
if( propertiesCache != null )
return propertiesCache;
propertiesCache = new Properties();
String text = textArea.getText();
try {
propertiesCache.load( new StringReader( textArea.getText() ) );
propertiesCache = UIDefaultsLoaderAccessor.newUIProperties( lastDark );
propertiesCache.load( new StringReader( text ) );
// re-load if dark has changed (getBaseTheme() invokes getProperties()!!!)
boolean dark = isDark( getBaseTheme() );
if( lastDark != dark ) {
lastDark = dark;
propertiesCache = UIDefaultsLoaderAccessor.newUIProperties( lastDark );
propertiesCache.load( new StringReader( text ) );
}
} catch( IOException ex ) {
ex.printStackTrace(); //TODO
}

View File

@@ -272,6 +272,8 @@ Component.innerFocusWidth
Component.innerOutlineWidth
Component.linkColor
Component.minimumWidth
Component.success.borderColor
Component.success.focusedBorderColor
Component.warning.borderColor
Component.warning.focusedBorderColor
DatePickerUI
@@ -1055,19 +1057,41 @@ TextPane.margin
TextPane.selectionBackground
TextPane.selectionForeground
TextPaneUI
TipOfTheDay.background
TipOfTheDay.border
TipOfTheDay.font
TipOfTheDay.icon
TipOfTheDay.icon.bulbColor
TipOfTheDay.icon.socketColor
TipOfTheDay.tipAreaInsets
TitlePane.background
TitlePane.borderColor
TitlePane.buttonArc
TitlePane.buttonBackground
TitlePane.buttonForeground
TitlePane.buttonHoverBackground
TitlePane.buttonHoverForeground
TitlePane.buttonInactiveBackground
TitlePane.buttonInactiveForeground
TitlePane.buttonInsets
TitlePane.buttonMaximizedHeight
TitlePane.buttonMinimumWidth
TitlePane.buttonPressedBackground
TitlePane.buttonPressedForeground
TitlePane.buttonSize
TitlePane.buttonSymbolHeight
TitlePane.buttonsFillVertically
TitlePane.buttonsGap
TitlePane.buttonsMargins
TitlePane.centerTitle
TitlePane.centerTitleIfMenuBarEmbedded
TitlePane.closeBackground
TitlePane.closeForeground
TitlePane.closeHoverBackground
TitlePane.closeHoverForeground
TitlePane.closeIcon
TitlePane.closeInactiveBackground
TitlePane.closeInactiveForeground
TitlePane.closePressedBackground
TitlePane.closePressedForeground
TitlePane.embeddedForeground
@@ -1089,17 +1113,32 @@ TitlePane.showIcon
TitlePane.showIconBesideTitle
TitlePane.showIconInDialogs
TitlePane.small.background
TitlePane.small.buttonArc
TitlePane.small.buttonBackground
TitlePane.small.buttonForeground
TitlePane.small.buttonHoverBackground
TitlePane.small.buttonHoverForeground
TitlePane.small.buttonInactiveBackground
TitlePane.small.buttonInactiveForeground
TitlePane.small.buttonInsets
TitlePane.small.buttonMaximizedHeight
TitlePane.small.buttonMinimumWidth
TitlePane.small.buttonPressedBackground
TitlePane.small.buttonPressedForeground
TitlePane.small.buttonSize
TitlePane.small.buttonSymbolHeight
TitlePane.small.buttonsFillVertically
TitlePane.small.buttonsGap
TitlePane.small.buttonsMargins
TitlePane.small.centerTitle
TitlePane.small.centerTitleIfMenuBarEmbedded
TitlePane.small.closeBackground
TitlePane.small.closeForeground
TitlePane.small.closeHoverBackground
TitlePane.small.closeHoverForeground
TitlePane.small.closeIcon
TitlePane.small.closeInactiveBackground
TitlePane.small.closeInactiveForeground
TitlePane.small.closePressedBackground
TitlePane.small.closePressedForeground
TitlePane.small.embeddedForeground
@@ -1323,6 +1362,7 @@ scrollbar
semibold.font
small.font
swingx/TaskPaneUI
swingx/TipOfTheDayUI
text
textHighlight
textHighlightText