| Author | DaveJarvis <email> |
|---|---|
| Date | 2022-11-05 12:22:46 GMT-0700 |
| Commit | d202c44f7391438cb32dc8a0ad6f15c5d1ff4371 |
| Parent | dd6f162 |
| Delta | 34 lines added, 30 lines removed, 4-line increase |
| import java.util.Properties; | ||
| import java.util.function.Consumer; | ||
| +import java.util.logging.LogManager; | ||
| import static com.keenwrite.Bootstrap.*; | ||
| error.printStackTrace( System.err ); | ||
| } | ||
| + } | ||
| + | ||
| + /** | ||
| + * Suppress writing to standard error, suppresses writing log messages. | ||
| + */ | ||
| + private static void disableLogging() { | ||
| + LogManager.getLogManager().reset(); | ||
| + stderrDisable(); | ||
| + } | ||
| + | ||
| + /** | ||
| + * TODO: Delete this after JavaFX/GTK 3 no longer barfs useless warnings. | ||
| + */ | ||
| + private static void stderrDisable() { | ||
| + System.err.close(); | ||
| } | ||
| private static void out( final String message, final Object... args ) { | ||
| System.out.printf( format( "%s%n", message ), args ); | ||
| + } | ||
| + | ||
| + private static void showAppInfo() { | ||
| + out( "%n%s version %s", APP_TITLE, APP_VERSION ); | ||
| + out( "Copyright 2016-%s White Magic Software, Ltd.", APP_YEAR ); | ||
| + out( "Portions copyright 2015-2020 Karl Tauber.%n" ); | ||
| } | ||
| } | ||
| else { | ||
| - MainApp.disableLogging(); | ||
| + disableLogging(); | ||
| } | ||
| log( t ); | ||
| } | ||
| - } | ||
| - | ||
| - private static void showAppInfo() { | ||
| - out( "%n%s version %s", APP_TITLE, APP_VERSION ); | ||
| - out( "Copyright 2016-%s White Magic Software, Ltd.", APP_YEAR ); | ||
| - out( "Portions copyright 2015-2020 Karl Tauber.%n" ); | ||
| } | ||
| } | ||
| import java.io.PrintStream; | ||
| import java.util.function.BooleanSupplier; | ||
| -import java.util.logging.LogManager; | ||
| import static com.keenwrite.Bootstrap.APP_TITLE; | ||
| private Workspace mWorkspace; | ||
| private MainScene mMainScene; | ||
| - | ||
| - /** | ||
| - * Suppress writing to standard error, suppresses writing log messages. | ||
| - */ | ||
| - static void disableLogging() { | ||
| - LogManager.getLogManager().reset(); | ||
| - stderrDisable(); | ||
| - } | ||
| - | ||
| - /** | ||
| - * TODO: Delete this after JavaFX/GTK 3 no longer barfs useless warnings. | ||
| - */ | ||
| - private static void stderrDisable() { | ||
| - System.err.close(); | ||
| - } | ||
| /** | ||
| @Override | ||
| public void start( final Stage stage ) { | ||
| - stderrDisable(); | ||
| - | ||
| // Must be instantiated after the UI is initialized (i.e., not in main) | ||
| // because it interacts with GUI properties. | ||
| package com.keenwrite; | ||
| +import com.keenwrite.collections.InterpolatingMap; | ||
| import com.keenwrite.preferences.Key; | ||
| import com.keenwrite.sigils.PropertyKeyOperator; | ||
| import com.keenwrite.sigils.SigilKeyOperator; | ||
| -import com.keenwrite.collections.InterpolatingMap; | ||
| import java.text.MessageFormat; | ||
| // locale cannot be changed using the application, making interpolation of | ||
| // values viable as a one-time operation. | ||
| - final var bundle = getBundle( APP_BUNDLE_NAME ); | ||
| + try { | ||
| + final var bundle = getBundle( APP_BUNDLE_NAME ); | ||
| - bundle.keySet().forEach( key -> MAP.put( key, bundle.getString( key ) ) ); | ||
| - MAP.interpolate(); | ||
| + bundle.keySet().forEach( key -> MAP.put( key, bundle.getString( key ) ) ); | ||
| + MAP.interpolate(); | ||
| + } catch( final Exception ignored ) { | ||
| + // This is bad, but it'll be extremely apparent when the UI loads. We | ||
| + // can't log this through regular channels because that'd lead to a | ||
| + // circular dependency. | ||
| + } | ||
| } | ||
| } | ||
| - private Messages() {} | ||
| + private Messages() { } | ||
| } | ||