Changeset 12715 in josm for trunk/src


Ignore:
Timestamp:
2017-09-03T21:49:05+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #15226 - see #2089 - support for compiling without JavaFX (modified patch by ris)

Location:
trunk/src/org/openstreetmap/josm/io/audio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/audio/AudioPlayer.java

    r12620 r12715  
    237237        double calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);
    238238        try {
    239             soundPlayer = new JavaFxMediaPlayer();
    240         } catch (NoClassDefFoundError | InterruptedException e) {
     239            soundPlayer = (SoundPlayer) Class.forName("org.openstreetmap.josm.io.audio.JavaFxMediaPlayer").getConstructor().newInstance();
     240        } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
     241            Logging.debug(e);
     242            Logging.warn("JOSM compiled without Java FX support. Falling back to Java Sound API");
     243        } catch (NoClassDefFoundError | JosmRuntimeException e) {
    241244            Logging.debug(e);
    242245            Logging.warn("Java FX is unavailable. Falling back to Java Sound API");
     246        }
     247        if (soundPlayer == null) {
    243248            soundPlayer = new JavaSoundPlayer(leadIn, calibration);
    244249        }
  • trunk/src/org/openstreetmap/josm/io/audio/JavaFxMediaPlayer.java

    r12462 r12715  
    1111import org.openstreetmap.josm.io.audio.AudioPlayer.Execute;
    1212import org.openstreetmap.josm.io.audio.AudioPlayer.State;
     13import org.openstreetmap.josm.tools.JosmRuntimeException;
    1314import org.openstreetmap.josm.tools.ListenerList;
    1415
     
    3738    private MediaPlayer mediaPlayer;
    3839
    39     JavaFxMediaPlayer() throws InterruptedException {
    40         initFxPlatform();
     40    JavaFxMediaPlayer() throws JosmRuntimeException {
     41        try {
     42            initFxPlatform();
     43        } catch (InterruptedException e) {
     44            throw new JosmRuntimeException(e);
     45        }
    4146    }
    4247
Note: See TracChangeset for help on using the changeset viewer.