Ticket #18925: 18925.patch
| File 18925.patch, 5.4 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/plugins/javafx/JavaFxPlugin.java
1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.javafx; 3 import static org.openstreetmap.josm.tools.I18n.tr; 3 4 4 5 import java.io.File; 5 6 import java.io.IOException; … … 14 15 import java.nio.file.StandardCopyOption; 15 16 import java.nio.file.attribute.BasicFileAttributes; 16 17 import java.security.CodeSource; 18 import java.util.Arrays; 17 19 import java.util.Enumeration; 18 20 import java.util.List; 19 21 import java.util.Objects; … … 20 22 import java.util.zip.ZipEntry; 21 23 import java.util.zip.ZipFile; 22 24 25 import javax.swing.UnsupportedLookAndFeelException; 26 23 27 import org.openstreetmap.josm.data.Preferences; 24 28 import org.openstreetmap.josm.io.audio.AudioPlayer; 25 29 import org.openstreetmap.josm.plugins.DynamicURLClassLoader; … … 27 31 import org.openstreetmap.josm.plugins.PluginInformation; 28 32 import org.openstreetmap.josm.plugins.javafx.io.audio.JavaFxMediaPlayer; 29 33 import org.openstreetmap.josm.tools.Logging; 34 import org.openstreetmap.josm.tools.Utils; 30 35 36 31 37 /** 32 38 * OpenJFX plugin brings OpenJFX (JavaFX) to other plugins. 33 39 */ 34 40 abstract class JavaFxPlugin extends Plugin { 35 41 42 Exception e; 36 43 /** 37 44 * Constructs a new {@code OpenJfxPlugin}. 38 45 * @param info plugin info 39 46 * @param ext native libraries extension 40 47 * @param orderedNativeLibraries native librarires that must be loaded in this order 48 * @throws UnsupportedLookAndFeelException if JavaFX is not available (< Java 10) 41 49 */ 42 protected JavaFxPlugin(PluginInformation info, String ext, List<String> orderedNativeLibraries) {50 protected JavaFxPlugin(PluginInformation info, String ext, List<String> orderedNativeLibraries) throws UnsupportedLookAndFeelException { 43 51 super(info); 44 AudioPlayer.setSoundPlayerClass(JavaFxMediaPlayer.class); 45 extractNativeLibs(ext); 46 loadNativeLibs(ext, orderedNativeLibraries); 52 boolean isJavaFx = Utils.getSystemProperty("javafx.runtime.version") != null || Arrays.asList("Oracle Corporation").contains(Utils.getSystemProperty("java.vendor")); 53 if (isJavaFx || Utils.getJavaVersion() >= 10) { 54 AudioPlayer.setSoundPlayerClass(JavaFxMediaPlayer.class); 55 } 56 if (!isJavaFx && Utils.getJavaVersion() >= 10) { 57 extractNativeLibs(ext); 58 loadNativeLibs(ext, orderedNativeLibraries); 59 } else if (!isJavaFx) { 60 throw new UnsupportedLookAndFeelException(tr("JavaFX is not available")); 61 } 47 62 } 48 63 49 64 private static void extractNativeLibs(String ext) { -
src/org/openstreetmap/josm/plugins/javafx/JavaFxPluginOsx.java
3 3 4 4 import java.util.Arrays; 5 5 6 import javax.swing.UnsupportedLookAndFeelException; 7 6 8 import org.openstreetmap.josm.plugins.PluginInformation; 7 9 8 10 /** … … 13 15 /** 14 16 * Constructs a new {@code JavaFxPluginOsx}. 15 17 * @param info plugin info 18 * @throws UnsupportedLookAndFeelException if JavaFX is not available (< Java 10) 16 19 */ 17 public JavaFxPluginOsx(PluginInformation info) {20 public JavaFxPluginOsx(PluginInformation info) throws UnsupportedLookAndFeelException { 18 21 super(info, ".dylib", Arrays.asList()); 19 22 } 20 23 } -
src/org/openstreetmap/josm/plugins/javafx/JavaFxPluginUnixoid.java
3 3 4 4 import java.util.Arrays; 5 5 6 import javax.swing.UnsupportedLookAndFeelException; 7 6 8 import org.openstreetmap.josm.plugins.PluginInformation; 7 9 8 10 /** … … 13 15 /** 14 16 * Constructs a new {@code JavaFxPluginUnixoid}. 15 17 * @param info plugin info 18 * @throws UnsupportedLookAndFeelException if JavaFX is not available (< Java 10) 16 19 */ 17 public JavaFxPluginUnixoid(PluginInformation info) {20 public JavaFxPluginUnixoid(PluginInformation info) throws UnsupportedLookAndFeelException { 18 21 super(info, ".so", Arrays.asList()); 19 22 } 20 23 } -
src/org/openstreetmap/josm/plugins/javafx/JavaFxPluginWindows.java
3 3 4 4 import java.util.Arrays; 5 5 6 import javax.swing.UnsupportedLookAndFeelException; 7 6 8 import org.openstreetmap.josm.plugins.PluginInformation; 7 9 8 10 /** … … 13 15 /** 14 16 * Constructs a new {@code JavaFxPluginWindows}. 15 17 * @param info plugin info 18 * @throws UnsupportedLookAndFeelException if JavaFX is not available (< Java 10) 16 19 */ 17 public JavaFxPluginWindows(PluginInformation info) {20 public JavaFxPluginWindows(PluginInformation info) throws UnsupportedLookAndFeelException { 18 21 super(info, ".dll", Arrays.asList("fxplugins.dll")); 19 22 } 20 23 }
