Changeset 35371 in osm for applications


Ignore:
Timestamp:
2020-03-16T23:15:34+01:00 (5 years ago)
Author:
donvip
Message:

fix #josm18925 - enable JavaFX plugin with Oracle Java 8 (patch by taylor.smock, modified)

Location:
applications/editors/josm/plugins/javafx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/javafx

    • Property svn:ignore
      •  

        old new  
        22build
        33javadoc
         4MANIFEST*
  • applications/editors/josm/plugins/javafx/build.xml

    r34729 r35371  
    1414    <property name="plugin.class.osx" value="org.openstreetmap.josm.plugins.javafx.JavaFxPluginOsx"/>
    1515    <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"/>
     16    <!--<property name="plugin.minimum.java.version" value="10"/>-->
    1717    <property name="plugin.provides" value="javafx"/>
    1818    <!--<property name="plugin.icon" value="..."/>-->
  • applications/editors/josm/plugins/javafx/src/org/openstreetmap/josm/plugins/javafx/JavaFxPlugin.java

    r34713 r35371  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.plugins.javafx;
     3import static org.openstreetmap.josm.tools.I18n.tr;
    34
    45import java.io.File;
     
    1516import java.nio.file.attribute.BasicFileAttributes;
    1617import java.security.CodeSource;
     18import java.util.Collections;
    1719import java.util.Enumeration;
    1820import java.util.List;
     
    2224
    2325import org.openstreetmap.josm.data.Preferences;
     26import org.openstreetmap.josm.gui.MainApplication;
    2427import org.openstreetmap.josm.io.audio.AudioPlayer;
    2528import org.openstreetmap.josm.plugins.DynamicURLClassLoader;
    2629import org.openstreetmap.josm.plugins.Plugin;
     30import org.openstreetmap.josm.plugins.PluginHandler;
    2731import org.openstreetmap.josm.plugins.PluginInformation;
    2832import org.openstreetmap.josm.plugins.javafx.io.audio.JavaFxMediaPlayer;
    2933import org.openstreetmap.josm.tools.Logging;
     34import org.openstreetmap.josm.tools.PlatformManager;
     35import org.openstreetmap.josm.tools.Utils;
    3036
    3137/**
    32  * OpenJFX plugin brings OpenJFX (JavaFX) to other plugins.
     38 * JavaFX plugin brings OpenJFX (JavaFX) to other plugins.
    3339 */
    3440abstract class JavaFxPlugin extends Plugin {
     
    3844     * @param info plugin info
    3945     * @param ext native libraries extension
    40      * @param orderedNativeLibraries native librarires that must be loaded in this order
     46     * @param orderedNativeLibraries native libraries that must be loaded in this order
    4147     */
    4248    protected JavaFxPlugin(PluginInformation info, String ext, List<String> orderedNativeLibraries) {
    4349        super(info);
     50        boolean isJavaFx = Utils.getSystemProperty("javafx.runtime.version") != null || ("Oracle Corporation".equals(Utils.getSystemProperty("java.vendor")) && Utils.getJavaVersion() < 11);
     51        if (!isJavaFx && Utils.getJavaVersion() >= 10) {
     52            extractNativeLibs(ext);
     53            loadNativeLibs(ext, orderedNativeLibraries);
     54        } else if (!isJavaFx) {
     55            Logging.error("JavaFX is not available");
     56            StringBuilder message = new StringBuilder(tr("JavaFX is not available."));
     57            PlatformManager.getPlatform();
     58            if (PlatformManager.isPlatformUnixoid()) {
     59                message.append(tr(" Please install OpenJFX through your package manager."));
     60            } else {
     61                message.append(tr(" Please update to Java 11+."));
     62            }
     63            if (PluginHandler.confirmDisablePlugin(MainApplication.getMainFrame(), message.toString(), info.getName())) {
     64                PluginHandler.removePlugins(Collections.singletonList(info));
     65            }
     66            return;
     67        }
    4468        AudioPlayer.setSoundPlayerClass(JavaFxMediaPlayer.class);
    45         extractNativeLibs(ext);
    46         loadNativeLibs(ext, orderedNativeLibraries);
    4769    }
    4870
Note: See TracChangeset for help on using the changeset viewer.