Ticket #18925: 18925.7.patch
| File 18925.7.patch, 4.0 KB (added by , 6 years ago) |
|---|
-
build.xml
13 13 <property name="plugin.class.unixoid" value="org.openstreetmap.josm.plugins.javafx.JavaFxPluginUnixoid"/> 14 14 <property name="plugin.class.osx" value="org.openstreetmap.josm.plugins.javafx.JavaFxPluginOsx"/> 15 15 <property name="plugin.description" value="Provides the OpenJFX (JavaFX) library for JOSM core and other JOSM plugins. Provides additional features such as MP3 audio playback."/> 16 <property name="plugin.minimum.java.version" value="10"/>17 16 <property name="plugin.provides" value="javafx"/> 18 17 <!--<property name="plugin.icon" value="..."/>--> 19 18 <!--<property name="plugin.link" value="..."/>--> -
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.Collections; 17 19 import java.util.Enumeration; 18 20 import java.util.List; 19 21 import java.util.Objects; … … 21 23 import java.util.zip.ZipFile; 22 24 23 25 import org.openstreetmap.josm.data.Preferences; 26 import org.openstreetmap.josm.gui.MainApplication; 24 27 import org.openstreetmap.josm.io.audio.AudioPlayer; 25 28 import org.openstreetmap.josm.plugins.DynamicURLClassLoader; 26 29 import org.openstreetmap.josm.plugins.Plugin; 30 import org.openstreetmap.josm.plugins.PluginHandler; 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.PlatformManager; 35 import org.openstreetmap.josm.tools.Utils; 30 36 37 31 38 /** 32 39 * OpenJFX plugin brings OpenJFX (JavaFX) to other plugins. 33 40 */ 34 41 abstract class JavaFxPlugin extends Plugin { 35 42 43 Exception e; 36 44 /** 37 45 * Constructs a new {@code OpenJfxPlugin}. 38 46 * @param info plugin info 39 47 * @param ext native libraries extension 40 * @param orderedNativeLibraries native librari res that must be loaded in this order48 * @param orderedNativeLibraries native libraries that must be loaded in this order 41 49 */ 42 50 protected JavaFxPlugin(PluginInformation info, String ext, List<String> orderedNativeLibraries) { 43 51 super(info); 52 boolean isJavaFx = Utils.getSystemProperty("javafx.runtime.version") != null || ("Oracle Corporation".equals(Utils.getSystemProperty("java.vendor")) && Utils.getJavaVersion() < 11); 53 if (!isJavaFx && Utils.getJavaVersion() >= 10) { 54 extractNativeLibs(ext); 55 loadNativeLibs(ext, orderedNativeLibraries); 56 } else if (!isJavaFx) { 57 Logging.error("JavaFX is not available"); 58 StringBuilder message = new StringBuilder(tr("JavaFX is not available.")); 59 PlatformManager.getPlatform(); 60 if (PlatformManager.isPlatformUnixoid()) { 61 message.append(tr(" Please install OpenJFX through your package manager.")); 62 } else { 63 message.append(tr(" Please update to Java 11+.")); 64 } 65 if (PluginHandler.confirmDisablePlugin(MainApplication.getMainFrame(), message.toString(), info.getName())) { 66 PluginHandler.removePlugins(Collections.singletonList(info)); 67 } 68 return; 69 } 44 70 AudioPlayer.setSoundPlayerClass(JavaFxMediaPlayer.class); 45 extractNativeLibs(ext);46 loadNativeLibs(ext, orderedNativeLibraries);47 71 } 48 72 49 73 private static void extractNativeLibs(String ext) {
