cui/source/options/optjava.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 2976590ed9f727c24064c97d80a51e9891253119
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Oct 21 10:23:30 2020 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Oct 22 07:40:45 2020 +0200

    Gray out Java options when framework's direct mode is used
    
    The 'javasettings_${_OS}_${_ARCH}.xml' files are only
    meant to be used when the application mode of the
    Java framework is used, not in direct mode.
    
    From ure/source/README:
    
    > You can also use the
    > UNO_JAVA_JFW_JREHOME deployment variable to specify the location of a 
JDK/JRE
    > installation.  For more information on this variable, see
    > http://udk.openoffice.org/common/man/spec/javavendorextension.sxw.
    
    From that http://udk.openoffice.org/common/man/spec/javavendorextension.sxw 
:
    
    > The direct mode of the framework is used within the build environment.
    > Java is needed there in order to register Java UNO components with the
    > regcomp tool. Direct mode means that no settings are written or read.
    > That is the parameters UNO_JAVA_JFW_USER_DATA and
    > UNO_JAVA_JFW_SHARED_DATA are not used.
    > [...]
    > Another example for using the direct mode is the SDK. The SDK uses the
    > libraries from the office installation. When an SDK is configured then
    > one specifies what Java is to be used. This Java shall then be used for
    > all task which require Java including registration of UNO components. In
    > order to override the java settings of the office the script which
    > prepares the SDK environment sets these environment variables:
    > UNO_JAVA_JFW_JREHOME=<file_URL_to_selected_Java>
    > UNO_JAVA_JFW_ENV_CLASSPATH=true
    > UNO_JAVA_JFW_VENDOR_SETTINGS=<file_URL_to_javavendors.xml_from_OOo>
    > By setting UNO_JAVA_JFW_JREHOME the framework is switched into direct mode
    > and the office settings are disregarded.
    
    Therefore, gray out the Java options in the "Advanced" page in "Tools"
    -> "Options" to not give the user the wrong impression that settings
    made there actually have any effect when using direct mode, e.g. by
    starting LibreOffice like this
    
        UNO_JAVA_JFW_JREHOME=file:///usr/lib/jvm/java-11-openjdk-amd64/ 
./instdir/program/soffice --writer
    
    and then realizing on restart that all manually made settings
    were discarded (e.g. newly added Java installation does not
    show up,...).
    
    Change-Id: Ife017f9b5c6c6488f84201dd78b23305c67bec1b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104002
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 3cfb0e535b12..6a54ab6e0fdf 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -564,7 +564,12 @@ void SvxJavaOptionsPage::Reset( const SfxItemSet* /*rSet*/ 
)
 #if HAVE_FEATURE_JAVA
     bool bEnabled = false;
     javaFrameworkError eErr = jfw_getEnabled( &bEnabled );
-    if ( eErr != JFW_E_NONE )
+    if (eErr == JFW_E_DIRECT_MODE)
+    {
+        // direct mode disregards Java settings made here, so gray them out
+        m_xJavaFrame->set_sensitive(false);
+    }
+    else if ( eErr != JFW_E_NONE )
         bEnabled = false;
     m_xJavaEnableCB->set_active(bEnabled);
     EnableHdl_Impl(*m_xJavaEnableCB);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to