mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 15:00:54 +03:00
Theme Editor: fixed missing keys (e.g. Button.foreground) in reference auto-completion, which are defined as wildcards or have some prefix
This commit is contained in:
@@ -361,8 +361,20 @@ class FlatCompletionProvider
|
|||||||
|
|
||||||
completions.clear();
|
completions.clear();
|
||||||
for( String key : keys ) {
|
for( String key : keys ) {
|
||||||
if( key.startsWith( "*." ) || key.startsWith( "[" ) )
|
if( key.startsWith( "[" ) ) {
|
||||||
|
// remove prefix
|
||||||
|
int closeIndex = key.indexOf( ']' );
|
||||||
|
if( closeIndex < 0 )
|
||||||
continue;
|
continue;
|
||||||
|
key = key.substring( closeIndex + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( key.startsWith( "*." ) ) {
|
||||||
|
// resolve wildcard
|
||||||
|
for( String k : FlatThemePropertiesSupport.getKeysForWildcard( key ) )
|
||||||
|
completions.add( new BasicCompletion( this, "$".concat( k ) ) );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( !key.startsWith( "@" ) )
|
if( !key.startsWith( "@" ) )
|
||||||
key = "$".concat( key );
|
key = "$".concat( key );
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.awt.Color;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -236,6 +237,21 @@ class FlatThemePropertiesSupport
|
|||||||
allKeysCache = null;
|
allKeysCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Set<String> getKeysForWildcard( String key ) {
|
||||||
|
if( !key.startsWith( "*." ) )
|
||||||
|
return Collections.emptySet();
|
||||||
|
|
||||||
|
loadKeysAllowedForWildcard();
|
||||||
|
|
||||||
|
String suffix = key.substring( 1 );
|
||||||
|
Set<String> result = new HashSet<>();
|
||||||
|
for( String k : wildcardKeys ) {
|
||||||
|
if( k.endsWith( suffix ) )
|
||||||
|
result.add( k );
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isKeyAllowedForWildcard( String key ) {
|
private static boolean isKeyAllowedForWildcard( String key ) {
|
||||||
loadKeysAllowedForWildcard();
|
loadKeysAllowedForWildcard();
|
||||||
return wildcardKeys.contains( key );
|
return wildcardKeys.contains( key );
|
||||||
|
|||||||
Reference in New Issue
Block a user