- java.lang.Object
-
- org.scijava.platform.AbstractPlatform
-
- org.scijava.desktop.platform.linux.LinuxPlatform
-
- All Implemented Interfaces:
DesktopIntegrationProvider,org.scijava.Disposable,org.scijava.platform.Platform,org.scijava.plugin.SciJavaPlugin,org.scijava.plugin.SingletonPlugin
public class LinuxPlatform extends org.scijava.platform.AbstractPlatform implements DesktopIntegrationProvider
A platform implementation for handling Linux platform issues.This implementation creates and maintains a .desktop file for the application, enabling proper desktop integration including:
- Application launcher in menus
- Application icon
- File associations
- URI scheme handling
- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description LinuxPlatform()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(org.scijava.platform.PlatformService service)SchemeInstallergetSchemeInstaller()Creates a SchemeInstaller for this platform.booleanisDesktopIconPresent()booleanisDesktopIconToggleable()booleanisFileExtensionsEnabled()booleanisFileExtensionsToggleable()booleanisWebLinksEnabled()booleanisWebLinksToggleable()voidopen(URL url)StringosName()voidsetDesktopIconPresent(boolean install)Installs or removes the desktop icon (application launcher, menu entry).voidsetFileExtensionsEnabled(boolean enable)Enables or disables file extension associations (e.g.,.tif,.png).voidsetWebLinksEnabled(boolean enable)Enables or disables URI scheme registration (e.g.,myapp://links).voidsyncDesktopIntegration(boolean webLinks, boolean desktopIcon, boolean fileTypes)Atomically applies all three desktop integration settings at once.
-
-
-
Method Detail
-
osName
public String osName()
- Specified by:
osNamein interfaceorg.scijava.platform.Platform
-
configure
public void configure(org.scijava.platform.PlatformService service)
- Specified by:
configurein interfaceorg.scijava.platform.Platform- Overrides:
configurein classorg.scijava.platform.AbstractPlatform
-
open
public void open(URL url) throws IOException
- Specified by:
openin interfaceorg.scijava.platform.Platform- Throws:
IOException
-
isWebLinksEnabled
public boolean isWebLinksEnabled()
- Specified by:
isWebLinksEnabledin interfaceDesktopIntegrationProvider
-
isWebLinksToggleable
public boolean isWebLinksToggleable()
- Specified by:
isWebLinksToggleablein interfaceDesktopIntegrationProvider
-
setWebLinksEnabled
public void setWebLinksEnabled(boolean enable) throws IOExceptionDescription copied from interface:DesktopIntegrationProviderEnables or disables URI scheme registration (e.g.,myapp://links).This operation only works if
DesktopIntegrationProvider.isWebLinksToggleable()returns true. Otherwise, calling this method may throwUnsupportedOperationException.- Specified by:
setWebLinksEnabledin interfaceDesktopIntegrationProvider- Parameters:
enable- whether to enable or disable web links- Throws:
IOException- if the operation fails
-
isDesktopIconPresent
public boolean isDesktopIconPresent()
- Specified by:
isDesktopIconPresentin interfaceDesktopIntegrationProvider
-
isDesktopIconToggleable
public boolean isDesktopIconToggleable()
- Specified by:
isDesktopIconToggleablein interfaceDesktopIntegrationProvider
-
setDesktopIconPresent
public void setDesktopIconPresent(boolean install) throws IOExceptionDescription copied from interface:DesktopIntegrationProviderInstalls or removes the desktop icon (application launcher, menu entry).This operation only works if
DesktopIntegrationProvider.isDesktopIconToggleable()returns true. Otherwise, calling this method may throwUnsupportedOperationException.- Specified by:
setDesktopIconPresentin interfaceDesktopIntegrationProvider- Parameters:
install- whether to install or remove the desktop icon- Throws:
IOException- if the operation fails
-
isFileExtensionsEnabled
public boolean isFileExtensionsEnabled()
- Specified by:
isFileExtensionsEnabledin interfaceDesktopIntegrationProvider
-
isFileExtensionsToggleable
public boolean isFileExtensionsToggleable()
- Specified by:
isFileExtensionsToggleablein interfaceDesktopIntegrationProvider
-
setFileExtensionsEnabled
public void setFileExtensionsEnabled(boolean enable) throws IOExceptionDescription copied from interface:DesktopIntegrationProviderEnables or disables file extension associations (e.g.,.tif,.png).This operation only works if
DesktopIntegrationProvider.isFileExtensionsToggleable()returns true. Otherwise, calling this method may throwUnsupportedOperationException.When enabled, the application will be registered as a handler for all supported file extensions. The application appears in "Open With" menus, allowing users to choose it for specific file types.
- Specified by:
setFileExtensionsEnabledin interfaceDesktopIntegrationProvider- Parameters:
enable- whether to enable or disable file extension associations- Throws:
IOException- if the operation fails
-
syncDesktopIntegration
public void syncDesktopIntegration(boolean webLinks, boolean desktopIcon, boolean fileTypes) throws IOExceptionDescription copied from interface:DesktopIntegrationProviderAtomically applies all three desktop integration settings at once.Implementations that store all three settings in a single artifact (e.g. a Linux
.desktopfile) should override this method to synthesize that artifact in one pass rather than via three independent read-modify-write cycles.The default implementation calls the three individual setters in order, guarded by the corresponding
isXxxToggleable()checks.- Specified by:
syncDesktopIntegrationin interfaceDesktopIntegrationProvider- Parameters:
webLinks- whether URI scheme handlers should be registereddesktopIcon- whether the application launcher entry should be presentfileTypes- whether file-extension associations should be registered- Throws:
IOException- if any part of the update fails
-
getSchemeInstaller
public SchemeInstaller getSchemeInstaller()
Description copied from interface:DesktopIntegrationProviderCreates a SchemeInstaller for this platform.- Specified by:
getSchemeInstallerin interfaceDesktopIntegrationProvider- Returns:
- a SchemeInstaller, or null if not supported on this platform
-
-