Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Truncate theme display name to 30 chars

AuthorDaveJarvis <email>
Date2021-05-16 11:35:43 GMT-0700
Commitd411993b39d73b15f542fb5ecf37daa995ef7887
Parent96e7f35
Delta6 lines added, 4 lines removed, 2-line increase
src/main/java/com/keenwrite/ui/dialogs/ThemePicker.java
import static com.keenwrite.Messages.get;
+import static com.keenwrite.constants.Constants.THEME_NAME_LENGTH;
import static com.keenwrite.constants.GraphicsConstants.ICON_DIALOG;
import static com.keenwrite.constants.GraphicsConstants.ICON_DIALOG_NODE;
import static com.keenwrite.events.StatusEvent.clue;
import static com.keenwrite.util.FileWalker.walk;
import static java.lang.Math.max;
+import static org.codehaus.plexus.util.StringUtils.abbreviate;
/**
walk( mThemes.toPath(), "**/theme.properties", ( path ) -> {
try {
- final var themeDisplay = readThemeName( path );
+ final var displayed = readThemeName( path );
final var themeName = path.getParent().toFile().getName();
- choices.put( themeDisplay, themeName );
+ choices.put( abbreviate( displayed, THEME_NAME_LENGTH ), themeName );
- // Used to set the selected item to value from user's settings.
+ // Set the selected item to user's settings value.
if( themeName.equals( mTheme.get() ) ) {
- selection[ 0 ] = themeDisplay;
+ selection[ 0 ] = displayed;
}
} catch( final Exception ex ) {