public interface PlatformHook
Modifier and Type | Interface and Description |
---|---|
static interface |
PlatformHook.JavaExpirationCallback
Called when an outdated version of Java is detected at startup.
|
static interface |
PlatformHook.NativeOsCallback
Called when interfacing with native OS functions.
|
Modifier and Type | Field and Description |
---|---|
static PlatformVisitor<PlatformHook> |
CONSTRUCT_FROM_PLATFORM
Visitor to construct a PlatformHook from a given
Platform object. |
Modifier and Type | Method and Description |
---|---|
default void |
afterPrefStartupHook()
The afterPrefStartupHook will be called early, but after
the preferences have been loaded and basic processing of
command line arguments is finished.
|
default boolean |
canFullscreen()
Determines if the platform allows full-screen.
|
default void |
checkExpiredJava(PlatformHook.JavaExpirationCallback callback)
Checks if the running version of Java has expired, proposes to user to update it if needed.
|
default java.lang.String |
exec(java.lang.String... command)
Executes a native command and returns the first line of standard output.
|
java.io.File |
getDefaultCacheDirectory()
Returns the platform-dependent default cache directory.
|
java.io.File |
getDefaultPrefDirectory()
Returns the platform-dependent default preferences directory.
|
default java.util.List<java.io.File> |
getDefaultProj4NadshiftDirectories()
Returns the list of platform-dependent default datum shifting directories for the PROJ.4 library.
|
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.
|
default int |
getMenuShortcutKeyMaskEx()
Returns extended modifier key used as the appropriate accelerator key for menu shortcuts.
|
default java.lang.String |
getOSBuildNumber()
Returns OS build number.
|
java.lang.String |
getOSDescription()
Returns a detailed OS description (at least family + version).
|
Platform |
getPlatform()
Get the platform corresponding to this platform hook.
|
default java.util.Collection<java.lang.String> |
getPossiblePreferenceDirs()
Returns a set of possible platform specific directories where resources could be stored.
|
default java.security.cert.X509Certificate |
getX509Certificate(CertificateAmendment.NativeCertAmend certAmend)
Returns the
X509Certificate matching the given certificate amendment information. |
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.
|
default boolean |
isOpenJDK()
Determines if the JVM is OpenJDK-based.
|
default java.lang.String |
makeTooltip(java.lang.String name,
Shortcut sc)
Deprecated.
|
void |
openUrl(java.lang.String url)
The openURL hook will be used to open an URL in the
default web browser.
|
default void |
preStartupHook()
The preStartupHook will be called extremely early.
|
default boolean |
rename(java.io.File from,
java.io.File to)
Renames a file.
|
default java.io.File |
resolveFileLink(java.io.File file)
Resolves a file link to its destination file.
|
default void |
setNativeOsCallback(PlatformHook.NativeOsCallback callback)
Registers the native OS callback.
|
default boolean |
setupHttpsCertificate(java.lang.String entryAlias,
java.security.KeyStore.TrustedCertificateEntry trustedCert)
Setup system keystore to add JOSM HTTPS certificate (for remote control).
|
default void |
startupHook(PlatformHook.JavaExpirationCallback callback)
The startupHook will be called early, but after the GUI
setup has started.
|
static final PlatformVisitor<PlatformHook> CONSTRUCT_FROM_PLATFORM
Platform
object.Platform getPlatform()
default void preStartupHook()
default void afterPrefStartupHook()
default void startupHook(PlatformHook.JavaExpirationCallback callback)
callback
- Java expiration callback, providing GUI feedbackvoid openUrl(java.lang.String url) throws java.io.IOException
url
- The URL to openjava.io.IOException
- if any I/O error occursvoid initSystemShortcuts()
@Deprecated default java.lang.String makeTooltip(java.lang.String name, Shortcut sc)
Shortcut.makeTooltip(java.lang.String, javax.swing.KeyStroke)
instead.name
- Tooltip text to displaysc
- Shortcut associated (to display accelerator between parenthesis)java.lang.String getDefaultStyle()
default boolean canFullscreen()
true
if full screen is allowed, false
otherwisedefault boolean rename(java.io.File from, java.io.File to)
from
- Source fileto
- Target filetrue
if the file has been renamed, false
otherwisejava.lang.String getOSDescription()
default java.lang.String getOSBuildNumber()
default 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
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.io.IOException
- in case of errorjava.security.cert.CertificateException
- in case of errorjava.security.NoSuchAlgorithmException
- in case of errordefault java.security.cert.X509Certificate getX509Certificate(CertificateAmendment.NativeCertAmend certAmend) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.io.IOException
X509Certificate
matching the given certificate amendment information.certAmend
- certificate amendmentX509Certificate
matching the given certificate amendment information, or null
java.security.KeyStoreException
- in case of errorjava.io.IOException
- in case of errorjava.security.cert.CertificateException
- in case of errorjava.security.NoSuchAlgorithmException
- in case of errordefault java.lang.String exec(java.lang.String... command) throws java.io.IOException
command
- array containing the command to call and its arguments.java.io.IOException
- if an I/O error occursjava.io.File getDefaultCacheDirectory()
java.io.File getDefaultPrefDirectory()
java.io.File getDefaultUserDataDirectory()
default java.util.List<java.io.File> getDefaultProj4NadshiftDirectories()
default boolean isOpenJDK()
true
if java.home
contains "openjdk", false
otherwisedefault int getMenuShortcutKeyMaskEx()
Toolkit.getMenuShortcutKeyMask()
to get the cross-platform modifier, but:
GuiHelper.getMenuShortcutKeyMaskEx()
)default void checkExpiredJava(PlatformHook.JavaExpirationCallback callback)
callback
- Java expiration callbackdefault void setNativeOsCallback(PlatformHook.NativeOsCallback callback)
callback
- the native OS callbackdefault java.io.File resolveFileLink(java.io.File file)
file
- file (link or regular file)default java.util.Collection<java.lang.String> getPossiblePreferenceDirs()