This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit a3767ac21efc20f6e35ed73b3046d57538c2e57c Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Mon Dec 4 16:23:32 2023 +0100 Fix the OpenJFX detection, including the wizard which was not started anymore. --- optional/src/org.apache.sis.gui/bundle/bin/sisfx | 43 +++++++++++++++++++++- .../src/org.apache.sis.gui/bundle/bin/sisfx.bat | 2 +- .../main/org/apache/sis/gui/setup/Wizard.java | 4 +- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/optional/src/org.apache.sis.gui/bundle/bin/sisfx b/optional/src/org.apache.sis.gui/bundle/bin/sisfx index 68a85b4ff9..3f5d9186cf 100755 --- a/optional/src/org.apache.sis.gui/bundle/bin/sisfx +++ b/optional/src/org.apache.sis.gui/bundle/bin/sisfx @@ -18,6 +18,10 @@ set -o errexit + +# +# Initialization. +# BASE_DIR="`dirname "$( readlink -e "$0"; )";`/.." . "$BASE_DIR/conf/setenv.sh" @@ -25,9 +29,43 @@ SIS_DATA="${SIS_DATA:-$BASE_DIR/data}" export SIS_DATA unset SIS_HOME + +# +# Check requirements. If no path to FX is specified, +# try the location used by some package managers. +# +MIN_FX_VERSION=20 +if [ -z "$PATH_TO_FX" ] +then + PATH_TO_FX=/usr/lib/jvm/openjfx +fi + + +# +# Check for a sentinel OpenJFX file and its version number. +# If too old, we will process as if no OpenJFX is installed. +# +if [ -r $PATH_TO_FX/javafx.controls.jar ] +then + FX_VERSION=`java --module-path=$PATH_TO_FX --describe-module=javafx.controls | grep --only-matching --max-count=1 "[0-9]\+" | head --lines=1` + if [ $FX_VERSION -lt $MIN_FX_VERSION ] + then + echo "Found OpenJFX $FX_VERSION in $PATH_TO_FX but requires OpenJFX $MIN_FX_VERSION." + unset PATH_TO_FX + else + export PATH_TO_FX + fi +else + unset PATH_TO_FX +fi + + +# +# If no suitable OpenJFX version has been found, start the installation wizard. +# if [ -z "$PATH_TO_FX" ] then - java --class-path "$BASE_DIR/lib/*" org.apache.sis.gui.setup.FXFinder $BASE_DIR/conf/setenv.sh + java --class-path "$BASE_DIR/lib/app/org.apache.sis.gui.jar" org.apache.sis.gui.setup.FXFinder $BASE_DIR/conf/setenv.sh if [ $? -ne 0 ] then exit @@ -35,7 +73,10 @@ then . "$BASE_DIR/conf/setenv.sh" fi + +# # Execute SIS with any optional JAR that the user may put in the `lib` directory. +# java -splash:"$BASE_DIR/lib/logo.jpg" \ --module-path "$PATH_TO_FX:$BASE_DIR/lib:$BASE_DIR/lib/app/org.apache.sis.gui.jar" \ -Djava.util.logging.config.class="org.apache.sis.util.logging.Initializer" \ diff --git a/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat b/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat index 1517a2b985..eaeca53264 100644 --- a/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat +++ b/optional/src/org.apache.sis.gui/bundle/bin/sisfx.bat @@ -21,7 +21,7 @@ CALL "%BASE_DIR%\conf\setenv.bat" SET SIS_DATA=%BASE_DIR%\data IF "%PATH_TO_FX%"=="" ( - java --class-path "%BASE_DIR%\lib\*" org.apache.sis.gui.setup.FXFinder "%BASE_DIR%\conf\setenv.bat" + java --class-path "%BASE_DIR%\lib\app\org.apache.sis.gui.jar" org.apache.sis.gui.setup.FXFinder "%BASE_DIR%\conf\setenv.bat" IF %ERRORLEVEL% GEQ 1 EXIT /B 1 CALL "%BASE_DIR%\conf\setenv.bat" ) diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java index 77b8d40d94..bd7312d744 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java @@ -385,7 +385,7 @@ final class Wizard extends FileFilter implements ActionListener, PropertyChangeL * @return the added button. */ private JButton createButton(final Box addTo, final String label) { - JButton button = new JButton(label); + var button = new JButton(label); button.setActionCommand(label); button.addActionListener(this); addTo.add(button); @@ -533,7 +533,7 @@ final class Wizard extends FileFilter implements ActionListener, PropertyChangeL * file or cancels. */ private void showDirectoryChooser() { - final JFileChooser fd = new JFileChooser(javafxFinder.getDirectory()); + final var fd = new JFileChooser(javafxFinder.getDirectory()); fd.addChoosableFileFilter(this); fd.setFileFilter(this); fd.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);