/** * Checks the available browser to see if it is an unsupported one. * * @return 'true' if in a unSupported browser environment 'false' otherwise. */ public synchronized boolean isUnsupportedBrowserEnvironment() { if ( getEnvironmentName().contains( "linux" ) ) { return false; } final String userAgent = getUserAgent(); if ( userAgent == null ) { return true; } return checkUserAgent( MSIE_PATTERN.matcher( userAgent ), getSupportedVersion( "min.windows.browser.supported" ) ) || checkUserAgent( SAFARI_PATTERN.matcher( userAgent ), getSupportedVersion( "min.mac.browser.supported" ) ); }
/** * Ask for the Operating system name. * * @return a string that contains the current Operating System. */ private String getEnvironmentName() { String osName = getOsName(); if ( osName.contentEquals( "linux" ) ) { return osName + " " + getLinuxDistribution().toLowerCase(); } return osName; }
/** * Checks the existence of the webkit library on ubuntu 16 or ubuntu 14 . * * @return 'true' if the webkit library is not present in ubuntu 16 or ubuntu 14 , 'false' otherwise. */ public synchronized boolean isWebkitUnavailable() { String path = getWebkitPath(); String osName = getEnvironmentName(); return ( ( path == null || path.length() < 1 || !path.contains( "webkit" ) ) && ( osName.contains( SUPPORTED_DISTRIBUTION_NAME + " " + getSupportedVersion( "max.ubuntu.os.distribution.supported" ) ) || osName.contains( SUPPORTED_DISTRIBUTION_NAME + " " + getSupportedVersion( "min.ubuntu.os.distribution.supported" ) ) ) ); }
private void checkEnvironment() { if ( EnvironmentUtils.getInstance().isBrowserEnvironmentCheckDisabled() ) { webkitUnavailable = null; unsupportedBrowserEnvironment = null; availableBrowser = ""; return; } webkitUnavailable = EnvironmentUtils.getInstance().isWebkitUnavailable(); unsupportedBrowserEnvironment = EnvironmentUtils.getInstance().isUnsupportedBrowserEnvironment(); availableBrowser = EnvironmentUtils.getInstance().getBrowserName(); if ( webkitUnavailable ) { ( new BrowserEnvironmentWarningDialog( shell ) ).showWarningDialog( BrowserEnvironmentWarningDialog.EnvironmentCase.UBUNTU ); return; } if ( unsupportedBrowserEnvironment ) { if ( availableBrowser.contains( EnvironmentUtils.WINDOWS_BROWSER ) ) { ( new BrowserEnvironmentWarningDialog( shell ) ).showWarningDialog( BrowserEnvironmentWarningDialog.EnvironmentCase.WINDOWS ); } else if ( availableBrowser.contains( EnvironmentUtils.MAC_BROWSER ) ) { ( new BrowserEnvironmentWarningDialog( shell ) ).showWarningDialog( BrowserEnvironmentWarningDialog.EnvironmentCase.MAC_OS_X ); } } }
/** * Ask for the running linux distribution. * * @return a string that contains the distribution name or a empty string if it could not find the name. */ private String getLinuxDistribution() { Process p = null; try { p = ExecuteCommand( "lsb_release -d" ); } catch ( IOException e ) { log.logError( "Could not execute command", e ); return ""; } BufferedReader in = getBufferedReaderFromProcess( p ); try { return in.readLine(); } catch ( IOException e ) { log.logError( "Could not read the distribution name", e ); return ""; } }
/** * Ask for the browser name. * * @return a String that contains the browser name. */ public synchronized String getBrowserName() { final String userAgent = getUserAgent(); if ( userAgent == null ) { return ""; } if ( userAgent.contains( WINDOWS_BROWSER ) ) { return WINDOWS_BROWSER; } else if ( userAgent.contains( UBUNTU_BROWSER ) ) { return UBUNTU_BROWSER; } else if ( userAgent.contains( MAC_BROWSER ) ) { return MAC_BROWSER; } return ""; }