public class PlatformHookUnixoid extends java.lang.Object implements PlatformHook
PlatformHook
base implementation.
Don't write (Main.platform instanceof PlatformHookUnixoid) because other platform
hooks are subclasses of this class.Modifier and Type | Class and Description |
---|---|
protected static class |
PlatformHookUnixoid.LinuxReleaseInfo |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
osDescription |
Constructor and Description |
---|
PlatformHookUnixoid() |
Modifier and Type | Method and Description |
---|---|
protected void |
askUpdateJava(java.lang.String version) |
protected void |
askUpdateJava(java.lang.String version,
java.lang.String url) |
protected java.lang.String |
buildOSDescription() |
boolean |
canFullscreen()
Determines if the platform allows full-screen.
|
java.io.File |
getDefaultCacheDirectory()
Returns the platform-dependent default cache directory.
|
java.io.File |
getDefaultPrefDirectory()
Returns the platform-dependent default preferences directory.
|
java.lang.String |
getDefaultStyle()
Returns the default LAF to be used on this platform to look almost as a native application.
|
java.io.File |
getDefaultUserDataDirectory()
Returns the platform-dependent default user data directory.
|
java.lang.String |
getJavaPackageDetails()
Get the Java package name including detailed version.
|
java.lang.String |
getOSDescription()
Returns a detailed OS description (at least family + version).
|
static java.lang.String |
getPackageDetails(java.lang.String... packageNames)
Get the package name including detailed version.
|
java.lang.String |
getWebStartPackageDetails()
Get the Web Start package name including detailed version.
|
void |
initSystemShortcuts()
The initSystemShortcuts hook will be called by the
Shortcut class after the modifier groups have been read
from the config, but before any shortcuts are read from
it or registered from within the application.
|
static boolean |
isOpenJDK()
Determines if the JVM is OpenJDK-based.
|
java.lang.String |
makeTooltip(java.lang.String name,
Shortcut sc)
This should work for all platforms.
|
void |
openUrl(java.lang.String url)
The openURL hook will be used to open an URL in the
default web browser.
|
void |
preStartupHook()
The preStartupHook will be called extremly early.
|
boolean |
rename(java.io.File from,
java.io.File to)
Renames a file.
|
boolean |
setupHttpsCertificate(java.lang.String entryAlias,
java.security.KeyStore.TrustedCertificateEntry trustedCert)
Setup system keystore to add JOSM HTTPS certificate (for remote control).
|
void |
startupHook()
The startupHook will be called early, but after the GUI
setup has started.
|
private java.lang.String osDescription
public PlatformHookUnixoid()
public void preStartupHook()
PlatformHook
preStartupHook
in interface PlatformHook
public void startupHook()
PlatformHook
startupHook
in interface PlatformHook
public void openUrl(java.lang.String url) throws java.io.IOException
PlatformHook
openUrl
in interface PlatformHook
url
- The URL to openjava.io.IOException
- if any I/O error occurspublic void initSystemShortcuts()
PlatformHook
initSystemShortcuts
in interface PlatformHook
public java.lang.String makeTooltip(java.lang.String name, Shortcut sc)
makeTooltip
in interface PlatformHook
name
- Tooltip text to displaysc
- Shortcut associated (to display accelerator between parenthesis)public java.lang.String getDefaultStyle()
PlatformHook
getDefaultStyle
in interface PlatformHook
public boolean canFullscreen()
PlatformHook
canFullscreen
in interface PlatformHook
true
if full screen is allowed, false
otherwisepublic boolean rename(java.io.File from, java.io.File to)
PlatformHook
rename
in interface PlatformHook
from
- Source fileto
- Target filetrue
if the file has been renamed, false
otherwisepublic static boolean isOpenJDK()
true
if java.home
contains "openjdk", false
otherwisepublic static java.lang.String getPackageDetails(java.lang.String... packageNames)
packageNames
- The possible package names (when a package can have different names on different distributions)public java.lang.String getJavaPackageDetails()
public java.lang.String getWebStartPackageDetails()
null
if there's no separate package for Java WebStart.protected java.lang.String buildOSDescription()
public java.lang.String getOSDescription()
PlatformHook
getOSDescription
in interface PlatformHook
protected void askUpdateJava(java.lang.String version)
protected void askUpdateJava(java.lang.String version, java.lang.String url)
public boolean setupHttpsCertificate(java.lang.String entryAlias, java.security.KeyStore.TrustedCertificateEntry trustedCert) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.io.IOException
PlatformHook
setupHttpsCertificate
in interface PlatformHook
entryAlias
- The entry alias to usetrustedCert
- the JOSM certificate for localhosttrue
if something has changed as a result of the call (certificate installation, etc.)java.security.KeyStoreException
- in case of errorjava.security.NoSuchAlgorithmException
- in case of errorjava.security.cert.CertificateException
- in case of errorjava.io.IOException
- in case of errorpublic java.io.File getDefaultCacheDirectory()
PlatformHook
getDefaultCacheDirectory
in interface PlatformHook
public java.io.File getDefaultPrefDirectory()
PlatformHook
getDefaultPrefDirectory
in interface PlatformHook
public java.io.File getDefaultUserDataDirectory()
PlatformHook
getDefaultUserDataDirectory
in interface PlatformHook