Class Platform
- the platform registry of installed plug-ins
- the platform adapter manager
- the platform log
- the authorization info management
Most users don't have to worry about Platform's lifecycle. However, if your
code can call methods of this class when Platform is not running, it becomes
necessary to check isRunning() before making the call. A runtime
exception might be thrown or incorrect result might be returned if a method
from this class is called while Platform is not running.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classConvenience class to query for the current OS. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant string (valueaarch64) indicating the platform is running on an AARCH64bit-based architecture.static final StringDeprecated.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringDeprecated.not supported anymorestatic final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringConstant string (valueppc64le) indicating the platform is running on an little-endian PowerPC 64bit based architecture.static final StringConstant string (valueriscv64indicating the platform is running on an RISC-V 64bit-based architecture.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringConstant string (valuex86_64) indicating the platform is running on an x86 64bit-based architecture.static final intStatus code constant (value 6) indicating the platform could not delete some of its metadata.static final intStatus code constant (value 4) indicating the platform could not read some of its metadata.static final intStatus code constant (value 5) indicating the platform could not write some of its metadata.static final intStatus code constant (value 3) indicating an error internal to the platform has occurred.static final intConstant (value 5) indicating the maximum allowed value for thePREF_PLATFORM_PERFORMANCEpreference setting.static final intConstant (value 1) indicating the minimum allowed value for thePREF_PLATFORM_PERFORMANCEpreference setting.static final StringDebug option value denoting the time at which the platform runtime was started.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringConstant string (valuelinuxindicating the platform is running on a Linux-based operating system.static final StringConstant string (valuemacosx) indicating the platform is running on a Mac OS X operating system.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringConstant string (valueunknown) indicating the platform is running on a machine running an unknown operating system.static final StringConstant string (valuewin32) indicating the platform is running on a Window 32-bit operating system (e.g., Windows 98, NT, 2000).static final intStatus code constant (value 1) indicating a problem in a plug-in manifest (plugin.xml) file.static final StringThe unique identifier constant (value "org.eclipse.core.runtime") of the Core Runtime (pseudo-) plug-in.static final intStatus code constant (value 2) indicating an error occurred while running a plug-in.static final StringConstant (value "line.separator") name of the preference used for storing the line separator.static final StringName of a preference for configuring the performance level for this system.static final StringThe simple identifier constant (value "adapters") of the extension point of the Core Runtime plug-in where plug-ins declare the existence of adapter factories.static final StringThe simple identifier constant (value "applications") of the extension point of the Core Runtime plug-in where plug-ins declare the existence of runnable applications.static final StringThe simple identifier constant (value "preferences") of the extension point of the Core Runtime plug-in where plug-ins declare extensions to the preference facility.static final StringThe simple identifier constant (value "products") of the extension point of the Core Runtime plug-in where plug-ins declare the existence of a product.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringConstant string (valuecocoa) indicating the platform is running on a machine using the Cocoa windowing system (Mac OS X).static final StringConstant string (valuegtk) indicating the platform is running on a machine using the GTK windowing system.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymorestatic final StringConstant string (valueunknown) indicating the platform is running on a machine running an unknown windowing system.static final StringConstant string (valuewin32) indicating the platform is running on a machine using the Windows windowing system.static final StringDeprecated, for removal: This API element is subject to removal in a future version.not supported anymore -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddLogListener(ILogListener listener) Adds the given log listener to the notification list of the platform.static voidaddProtectionSpace(URL resourceUrl, String realm) Deprecated, for removal: This API element is subject to removal in a future version.Authorization database is superseded by the Equinox secure storage.static URLasLocalURL(URL url) Deprecated, for removal: This API element is subject to removal in a future version.useFileLocator.toFileURL(URL)insteadstatic voidDeprecated, for removal: This API element is subject to removal in a future version.useIApplicationContext.applicationRunning()insteadstatic URLDeprecated, for removal: This API element is subject to removal in a future version.static URLDeprecated, for removal: This API element is subject to removal in a future version.useFileLocator.find(Bundle, IPath, Map)insteadstatic IAdapterManagerReturns the adapter manager used for extendingIAdaptableobjects.static String[]Returns the arguments not consumed by the framework implementation itself.static BundleReturns the resolved bundle with the specified symbolic name that has the highest version.static IBundleGroupProvider[]Returns the currently registered bundle group providers.static Bundle[]getBundles(String symbolicName, String version) Returns all bundles with the specified symbolic name.static String[]Returns the command line args provided to the Eclipse runtime layer when it was first run.static LocationReturns the location of the configuration information used to run this instance of Eclipse.static IContentTypeManagerReturns the content type manager.static booleangetDebugBoolean(String option) Returns whether the identified option istrue.static StringgetDebugOption(String option) Returns the identified option.static IExtensionRegistryReturns the extension registry for this platform.static Bundle[]getFragments(Bundle bundle) Returns an array of attached fragment bundles for the specified bundle.static Bundle[]Returns an array of host bundles that the specified fragment bundle is attached to ornullif the specified bundle is not attached to a host.static LocationReturns the location of the base installation for the running platformnullis returned if the platform is running without a configuration location.static LocationReturns the location of the platform's working directory (also known as the instance data area).static IPathReturns the location of the platform working directory.static ILogReturns the log for the bundle of the given class.static ILogReturns the log for the given bundle.static IPathReturns the location of the platform log file.static StringgetNL()Returns the string name of the current locale for use in finding files whose path starts with$nl$.static StringReturns Unicode locale extensions for the Unicode locale identifier, if they are defined.static StringgetOS()Returns the string name of the current operating system for use in finding files whose path starts with$os$.static StringReturns the string name of the current system architecture.static PlatformAdminDeprecated, for removal: This API element is subject to removal in a future version.only consumer is PDE and this should never be used by other clients, see javadoc for details.static PluginDeprecated, for removal: This API element is subject to removal in a future version.static IPreferencesServiceReturn the interface into the preference mechanism.static IProductReturns the product which was selected when running this Eclipse instance ornullif nonestatic ResourceBundlegetResourceBundle(Bundle bundle) Returns the given bundle's resource bundle for the current locale.static StringgetResourceString(Bundle bundle, String value) Returns a resource string corresponding to the given argument value.static StringgetResourceString(Bundle bundle, String value, ResourceBundle resourceBundle) Returns a resource string corresponding to the given argument value and resource bundle in the given runtime bundle.static IPathgetStateLocation(Bundle bundle) Returns the location in the local file system of the plug-in state area for the given bundle.static longReturns a number that changes whenever the set of installed plug-ins changes.static CharsetRetrieves the system encoding (Charset) based on the locale set in the current user environment.static LocationReturns the location of the platform's user data area.static StringgetWS()Returns the string name of the current window system for use in finding files whose path starts with$ws$.static booleanReturnstrueif the platform is currently running in debug mode.static booleanReturnstrueif the platform is currently running in development mode.static booleanisFragment(Bundle bundle) Checks if the specified bundle is a fragment bundle.static booleanReturns whether the platform is running.static String[]Returns a list of known system architectures.static String[]Returns a list of known operating system names.Returns a map of known platform line separators.static String[]Returns a list of known windowing system names.static voidRegisters the given bundle group provider with the platform.static voidremoveLogListener(ILogListener listener) Removes the indicated (identical) log listener from the notification list of the platform.static URLDeprecated, for removal: This API element is subject to removal in a future version.useFileLocator.resolve(URL)insteadstatic voidrun(ISafeRunnable runnable) Deprecated, for removal: This API element is subject to removal in a future version.clients should useSafeRunner#runinsteadstatic voidDe-registers the given bundle group provider with the platform.
-
Field Details
-
PI_RUNTIME
The unique identifier constant (value "org.eclipse.core.runtime") of the Core Runtime (pseudo-) plug-in.- See Also:
-
PT_APPLICATIONS
The simple identifier constant (value "applications") of the extension point of the Core Runtime plug-in where plug-ins declare the existence of runnable applications. A plug-in may define any number of applications; however, the platform is only capable of running one application at a time.- See Also:
-
PT_ADAPTERS
The simple identifier constant (value "adapters") of the extension point of the Core Runtime plug-in where plug-ins declare the existence of adapter factories. A plug-in may define any number of adapters.- Since:
- 3.0
- See Also:
-
PT_PREFERENCES
The simple identifier constant (value "preferences") of the extension point of the Core Runtime plug-in where plug-ins declare extensions to the preference facility. A plug-in may define any number of preference extensions.- Since:
- 3.0
- See Also:
-
PT_PRODUCT
The simple identifier constant (value "products") of the extension point of the Core Runtime plug-in where plug-ins declare the existence of a product. A plug-in may define any number of products; however, the platform is only capable of running one product at a time.- Since:
- 3.0
- See Also:
-
OPTION_STARTTIME
Debug option value denoting the time at which the platform runtime was started. This constant can be used in conjunction withgetDebugOptionto find the string value ofSystem.currentTimeMillis()when the platform was started.- See Also:
-
PREF_PLATFORM_PERFORMANCE
Name of a preference for configuring the performance level for this system.This value can be used by all components to customize features to suit the speed of the user's machine. The platform job manager uses this value to make scheduling decisions about background jobs.
The preference value must be an integer between the constant values MIN_PERFORMANCE and MAX_PERFORMANCE
- Since:
- 3.0
- See Also:
-
PREF_LINE_SEPARATOR
Constant (value "line.separator") name of the preference used for storing the line separator.- Since:
- 3.1
- See Also:
-
MIN_PERFORMANCE
public static final int MIN_PERFORMANCEConstant (value 1) indicating the minimum allowed value for thePREF_PLATFORM_PERFORMANCEpreference setting.- Since:
- 3.0
- See Also:
-
MAX_PERFORMANCE
public static final int MAX_PERFORMANCEConstant (value 5) indicating the maximum allowed value for thePREF_PLATFORM_PERFORMANCEpreference setting.- Since:
- 3.0
- See Also:
-
PARSE_PROBLEM
public static final int PARSE_PROBLEMStatus code constant (value 1) indicating a problem in a plug-in manifest (plugin.xml) file.- See Also:
-
PLUGIN_ERROR
public static final int PLUGIN_ERRORStatus code constant (value 2) indicating an error occurred while running a plug-in.- See Also:
-
INTERNAL_ERROR
public static final int INTERNAL_ERRORStatus code constant (value 3) indicating an error internal to the platform has occurred.- See Also:
-
FAILED_READ_METADATA
public static final int FAILED_READ_METADATAStatus code constant (value 4) indicating the platform could not read some of its metadata.- See Also:
-
FAILED_WRITE_METADATA
public static final int FAILED_WRITE_METADATAStatus code constant (value 5) indicating the platform could not write some of its metadata.- See Also:
-
FAILED_DELETE_METADATA
public static final int FAILED_DELETE_METADATAStatus code constant (value 6) indicating the platform could not delete some of its metadata.- See Also:
-
OS_WIN32
Constant string (valuewin32) indicating the platform is running on a Window 32-bit operating system (e.g., Windows 98, NT, 2000).Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_LINUX
Constant string (valuelinuxindicating the platform is running on a Linux-based operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_AIX
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valueaixindicating the platform is running on an AIX-based operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_SOLARIS
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuesolaris) indicating the platform is running on a Solaris-based operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_HPUX
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuehpux) indicating the platform is running on an HP/UX-based operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_QNX
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valueqnx) indicating the platform is running on a QNX-based operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_MACOSX
Constant string (valuemacosx) indicating the platform is running on a Mac OS X operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
OS_UNKNOWN
Constant string (valueunknown) indicating the platform is running on a machine running an unknown operating system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
ARCH_X86
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuex86) indicating the platform is running on an x86-based architecture.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
ARCH_PA_RISC
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuePA_RISC) indicating the platform is running on an PA_RISC-based architecture.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
ARCH_PPC
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valueppc) indicating the platform is running on an PowerPC-based architecture.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
ARCH_SPARC
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuesparc) indicating the platform is running on an Sparc-based architecture.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
ARCH_X86_64
Constant string (valuex86_64) indicating the platform is running on an x86 64bit-based architecture.- Since:
- 3.1
- See Also:
-
ARCH_AARCH64
Constant string (valueaarch64) indicating the platform is running on an AARCH64bit-based architecture.- Since:
- 3.22
- See Also:
-
ARCH_PPC64LE
Constant string (valueppc64le) indicating the platform is running on an little-endian PowerPC 64bit based architecture.- Since:
- 3.32
- See Also:
-
ARCH_RISCV64
Constant string (valueriscv64indicating the platform is running on an RISC-V 64bit-based architecture.- Since:
- 3.32
- See Also:
-
ARCH_AMD64
Deprecated.useARCH_X86_64instead. Note the values has been changed to be the value of theARCH_X86_64constant.Constant string (valueamd64) indicating the platform is running on an AMD64-based architecture.- Since:
- 3.0
- See Also:
-
ARCH_IA64
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valueia64) indicating the platform is running on an IA64-based architecture.- Since:
- 3.0
- See Also:
-
ARCH_IA64_32
Deprecated.not supported anymoreConstant string (valueia64_32) indicating the platform is running on an IA64 32bit-based architecture.- Since:
- 3.1
- See Also:
-
WS_WIN32
Constant string (valuewin32) indicating the platform is running on a machine using the Windows windowing system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
WS_MOTIF
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuemotif) indicating the platform is running on a machine using the Motif windowing system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
WS_GTK
Constant string (valuegtk) indicating the platform is running on a machine using the GTK windowing system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
WS_PHOTON
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuephoton) indicating the platform is running on a machine using the Photon windowing system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
WS_CARBON
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuecarbon) indicating the platform is running on a machine using the Carbon windowing system (Mac OS X).Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
WS_COCOA
Constant string (valuecocoa) indicating the platform is running on a machine using the Cocoa windowing system (Mac OS X).- Since:
- 3.5
- See Also:
-
WS_WPF
Deprecated, for removal: This API element is subject to removal in a future version.not supported anymoreConstant string (valuewpf) indicating the platform is running on a machine using the WPF windowing system.- Since:
- 3.3
- See Also:
-
WS_UNKNOWN
Constant string (valueunknown) indicating the platform is running on a machine running an unknown windowing system.Note this constant has been moved from the deprecated org.eclipse.core.boot.BootLoader class and its value has not changed.
- Since:
- 3.0
- See Also:
-
-
Method Details
-
addLogListener
Adds the given log listener to the notification list of the platform.Once registered, a listener starts receiving notification as entries are added to plug-in logs via
ILog.log(). The listener continues to receive notifications until it is replaced or removed.- Parameters:
listener- the listener to register- See Also:
-
addProtectionSpace
@Deprecated(forRemoval=true, since="2024-03") public static void addProtectionSpace(URL resourceUrl, String realm) throws CoreException Deprecated, for removal: This API element is subject to removal in a future version.Authorization database is superseded by the Equinox secure storage. Useorg.eclipse.equinox.security.storage.SecurePreferencesFactoryto obtain secure preferences andorg.eclipse.equinox.security.storage.ISecurePreferencesfor data access and modifications. This API will be deleted in a future release. See bug 370248 for details.Adds the specified resource to the protection space specified by the given realm. All targets at or deeper than the depth of the last symbolic element in the path of the given resource URL are assumed to be in the same protection space.- Parameters:
resourceUrl- the URL identifying the resources to be added to the specified protection space. For example, "http://www.example.com/folder/".realm- the name of the protection space. For example, "realm1@example.com"- Throws:
CoreException- if there are problems setting the authorization information. Reasons include:- The key ring could not be saved.
-
asLocalURL
@Deprecated(forRemoval=true, since="2025-03") public static URL asLocalURL(URL url) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.useFileLocator.toFileURL(URL)insteadReturns a URL that is the local equivalent of the supplied URL. This method is expected to be used with the plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry() and Platform.find(). If the specified URL is not a plug-in-relative URL, it is returned as is. If the specified URL is a plug-in-relative URL of a file (including .jar archive), it is returned as a locally accessible URL using "file:" protocol (extracting/caching the file locally, if required). If the specified URL is a plug-in-relative URL of a directory, the directory and any files and directories under it are made locally accessible likewise.- Parameters:
url- original plug-in-relative URL.- Returns:
- the resolved URL
- Throws:
IOException- if unable to resolve URL- See Also:
-
endSplash
Deprecated, for removal: This API element is subject to removal in a future version.useIApplicationContext.applicationRunning()insteadTakes down the splash screen if one was put up. -
getAdapterManager
Returns the adapter manager used for extendingIAdaptableobjects.- Returns:
- the adapter manager for this platform
- See Also:
-
getCommandLineArgs
Returns the command line args provided to the Eclipse runtime layer when it was first run. The returned value does not include arguments consumed by the lower levels of Eclipse (e.g., OSGi or the launcher). Note that individual platform runnables may be provided with different arguments if they are being run individually rather than withPlatform.run().Clients are also able to acquire the
EnvironmentInfoservice and query it for the command-line arguments.- Returns:
- the command line used to start the platform
-
getContentTypeManager
Returns the content type manager.Clients are also able to acquire the
IContentTypeManagerservice.- Returns:
- the content type manager
- Since:
- 3.0
-
getDebugOption
Returns the identified option.nullis returned if no such option is found. Options are specified in the general form <plug-in id>/<option-path>. For example,org.eclipse.core.runtime/debugClients are also able to acquire the
DebugOptionsservice and query it for debug options.- Parameters:
option- the name of the option to lookup- Returns:
- the value of the requested debug option or
null
-
getDebugBoolean
Returns whether the identified option istrue.falseis returned if no such option is found, or if the string is not "true" (ignoring case). Options are specified in the general form <plug-in id>/<option-path>. For example,org.eclipse.core.runtime/debug=trueClients are also able to acquire theDebugOptionsservice and query it for debug options. See @linkgetDebugOption(String)- Parameters:
option- the name of the option to lookup- Returns:
trueif the value is equal to the string "true" orfalseotherwise- Since:
- 3.19
-
getLocation
Returns the location of the platform working directory.Callers of this method should consider using
getInstanceLocationinstead. In various, typically non IDE-related configurations of Eclipse, the platform working directory may not be on the local file system. As such, the more general form of this location is as a URL.Alternatively, instead of calling
getInstanceLocationclients are able to acquire theLocationservice (with the typeLocation.INSTANCE_FILTER) and then change the resulting URL to a path. See the javadoc forgetInstanceLocationfor more details.- Returns:
- the location of the platform
- Throws:
IllegalStateException- See Also:
-
getLogFileLocation
Returns the location of the platform log file. This file may contain information about errors that have previously occurred during this invocation of the Platform.It is recommended not to keep this value, as the log location may vary when an instance location is being set.
Note: it is very important that users of this method do not leave the log file open for extended periods of time. Doing so may prevent others from writing to the log file, which could result in important error messages being lost. It is strongly recommended that clients wanting to read the log file for extended periods should copy the log file contents elsewhere, and immediately close the original file.
- Returns:
- the path of the log file on disk.
-
getPlugin
Deprecated, for removal: This API element is subject to removal in a future version.As the org.eclipse.core.runtime.compatibility plug-in has been removed in Eclipse 4.6 this method is not supported anymore. -
removeLogListener
Removes the indicated (identical) log listener from the notification list of the platform. If no such listener exists, no action is taken.- Parameters:
listener- the listener to de-register- See Also:
-
resolve
Deprecated, for removal: This API element is subject to removal in a future version.useFileLocator.resolve(URL)insteadReturns a URL which is the resolved equivalent of the supplied URL. This method is expected to be used with the plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry() and Platform.find().If the specified URL is not a plug-in-relative URL, it is returned as is. If the specified URL is a plug-in-relative URL, this method attempts to reduce the given URL to one which is native to the Java class library (eg. file, http, etc).
Note however that users of this API should not assume too much about the results of this method. While it may consistently return a file: URL in certain installation configurations, others may result in jar: or http: URLs.
- Parameters:
url- original plug-in-relative URL.- Returns:
- the resolved URL
- Throws:
IOException- if unable to resolve URL- See Also:
-
run
Deprecated, for removal: This API element is subject to removal in a future version.clients should useSafeRunner#runinsteadRuns the given runnable in a protected mode. Exceptions thrown in the runnable are logged and passed to the runnable's exception handler. Such exceptions are not rethrown by this method.- Parameters:
runnable- the runnable to run
-
getExtensionRegistry
Returns the extension registry for this platform.Note this method is purely a convenience and
RegistryFactory.getRegistry()should generally be used instead.- Returns:
- the extension registry
- Since:
- 3.0
- See Also:
-
find
Deprecated, for removal: This API element is subject to removal in a future version.Returns a URL for the given path in the given bundle. Returnsnullif the URL could not be computed or created.- Parameters:
bundle- the bundle in which to searchpath- path relative to plug-in installation location- Returns:
- a URL for the given path or
null. The actual form of the returned URL is not specified. - Since:
- 3.0
- See Also:
-
find
@Deprecated(forRemoval=true, since="2025-03") public static URL find(Bundle bundle, IPath path, Map<String, String> override) Deprecated, for removal: This API element is subject to removal in a future version.useFileLocator.find(Bundle, IPath, Map)insteadReturns a URL for the given path in the given bundle. Returnsnullif the URL could not be computed or created.find looks for this path in given bundle and any attached fragments.
nullis returned if no such entry is found. Note that there is no specific order to the fragments.The following arguments may also be used:
$nl$ - for language specific information $os$ - for operating system specific information $ws$ - for windowing system specific informationA path of $nl$/about.properties in an environment with a default locale of en_CA will return a URL corresponding to the first place about.properties is found according to the following order:
plugin root/nl/en/CA/about.properties fragment1 root/nl/en/CA/about.properties fragment2 root/nl/en/CA/about.properties ... plugin root/nl/en/about.properties fragment1 root/nl/en/about.properties fragment2 root/nl/en/about.properties ... plugin root/about.properties fragment1 root/about.properties fragment2 root/about.properties ...The current environment variable values can be overridden using the override map argument.
- Parameters:
bundle- the bundle in which to searchpath- file path relative to plug-in installation locationoverride- map of override substitution arguments to be used for any $arg$ path elements. The map keys correspond to the substitution arguments (eg. "$nl$" or "$os$"). The resulting values must be of type java.lang.String. If the map isnull, or does not contain the required substitution argument, the default is used.- Returns:
- a URL for the given path or
null. The actual form of the returned URL is not specified. - Since:
- 3.0
- See Also:
-
getStateLocation
Returns the location in the local file system of the plug-in state area for the given bundle. If the plug-in state area did not exist prior to this call, it is created.The plug-in state area is a file directory within the platform's metadata area where a plug-in is free to create files. The content and structure of this area is defined by the plug-in, and the particular plug-in is solely responsible for any files it puts there. It is recommended for plug-in preference settings and other configuration parameters.
- Parameters:
bundle- the bundle whose state location if returned- Returns:
- a local file system path
- Since:
- 3.0
-
getStateStamp
public static long getStateStamp()Returns a number that changes whenever the set of installed plug-ins changes. This can be used for invalidating caches that are based on the set of currently installed plug-ins. (e.g. extensions)Clients are also able to acquire the
PlatformAdminservice and get the timestamp from its state object.- Returns:
- a number related to the set of installed plug-ins
- Since:
- 3.1
-
getLog
Returns the log for the given bundle. If no such log exists, one is created.- Parameters:
bundle- the bundle whose log is returned- Returns:
- the log for the given bundle
- Since:
- 3.0
-
getLog
Returns the log for the bundle of the given class. If no such log exists, one is created.- Parameters:
clazz- the class in a bundle whose log is returned- Returns:
- the log for the bundle to which the bundle belongs
- Since:
- 3.16
-
getResourceBundle
Returns the given bundle's resource bundle for the current locale.This resource bundle is typically stored as the plugin.properties file in the plug-in itself, and contains any translatable strings used in the plug-in manifest file (plugin.xml).
This mechanism is intended only for externalizing strings found in the plug-in manifest file. Using this method for externalizing strings in your code may result in degraded memory performance.
- Parameters:
bundle- the bundle whose resource bundle is being queried- Returns:
- the resource bundle
- Throws:
MissingResourceException- if the resource bundle was not found- Since:
- 3.0
-
getResourceString
Returns a resource string corresponding to the given argument value. If the argument value specifies a resource key, the string is looked up in the default resource bundle for the given runtime bundle. If the argument does not specify a valid key, the argument itself is returned as the resource string. The key lookup is performed in the file referenced in the Bundle-Localization header of the bundle manifest. If a resource string corresponding to the key is not found in the resource bundle the key value, or any default text following the key in the argument value is returned as the resource string. A key is identified as a string beginning with the "%" character. Note, that the "%" character is stripped off prior to lookup in the resource bundle.Equivalent to
getResourceString(bundle, value, getResourceBundle())- Parameters:
bundle- the bundle whose resource bundle is being queriedvalue- the value to look for- Returns:
- the resource string
- Since:
- 3.0
- See Also:
-
getResourceString
Returns a resource string corresponding to the given argument value and resource bundle in the given runtime bundle. If the argument value specifies a resource key, the string is looked up in the given resource bundle. If the argument does not specify a valid key, the argument itself is returned as the resource string. The key lookup is performed against the specified resource bundle. If a resource string corresponding to the key is not found in the resource bundle the key value, or any default text following the key in the argument value is returned as the resource string. A key is identified as a string beginning with the "%" character. Note that the "%" character is stripped off prior to lookup in the resource bundle.For example, assume resource bundle plugin.properties contains name = Project Name
getResourceString("Hello World") returns "Hello World" getResourceString("%name") returns "Project Name" getResourceString("%name Hello World") returns "Project Name" getResourceString("%abcd Hello World") returns "Hello World" getResourceString("%abcd") returns "%abcd" getResourceString("%%name") returns "%name"- Parameters:
bundle- the bundle whose resource bundle is being queriedvalue- the valueresourceBundle- the resource bundle to query- Returns:
- the resource string
- Since:
- 3.0
- See Also:
-
getOSArch
Returns the string name of the current system architecture. The value is a user-defined string if the architecture is specified on the command line, otherwise it is the value returned byjava.lang.System.getProperty("os.arch").Clients are also able to acquire the
EnvironmentInfoservice and query it for the operating-system architecture.- Returns:
- the string name of the current system architecture
- Since:
- 3.0
-
getNL
Returns the string name of the current locale for use in finding files whose path starts with$nl$.Clients are also able to acquire the
EnvironmentInfoservice and query it for the NL.- Returns:
- the string name of the current locale
- Since:
- 3.0
-
getNLExtensions
Returns Unicode locale extensions for the Unicode locale identifier, if they are defined. An empty string is returned if Unicode locale extensions are not defined.For more information on Unicode locale extensions, see Unicode Technical Standard #35.
- Returns:
- The defined Unicode locale extensions, or an empty string.
- Since:
- 3.5
-
getOS
Returns the string name of the current operating system for use in finding files whose path starts with$os$.OS_UNKNOWNis returned if the operating system cannot be determined. The value may indicate one of the operating systems known to the platform (as specified inknownOSValues) or a user-defined string if the operating system name is specified on the command line.Clients are also able to acquire the
EnvironmentInfoservice and query it for the operating-system.- Returns:
- the string name of the current operating system
- Since:
- 3.0
-
getWS
Returns the string name of the current window system for use in finding files whose path starts with$ws$.nullis returned if the window system cannot be determined.Clients are also able to acquire the
EnvironmentInfoservice and query it for the windowing system.- Returns:
- the string name of the current window system or
null - Since:
- 3.0
-
getApplicationArgs
Returns the arguments not consumed by the framework implementation itself. Which arguments are consumed is implementation specific. These arguments are available for use by the application.- Returns:
- the array of command line arguments not consumed by the framework.
- Since:
- 3.0
-
getPlatformAdmin
Deprecated, for removal: This API element is subject to removal in a future version.only consumer is PDE and this should never be used by other clients, see javadoc for details.Returns the platform administrator for this running Eclipse.Note: This is an internal method and must not be used by clients which are not part of the Eclipse Platform. This method allows access to classes which are not Eclipse Platform API but are part of the OSGi runtime that the Eclipse Platform is built on. Even as the Eclipse Platform evolves in compatible ways from release to release, the details of the OSGi implementation might not.
Clients can also acquire the
PlatformAdminservice to retrieve this object.- Returns:
- the platform admin for this instance of Eclipse
- Since:
- 3.0
-
getInstanceLocation
Returns the location of the platform's working directory (also known as the instance data area).nullis returned if the platform is running without an instance location.This method is equivalent to acquiring the
org.eclipse.osgi.service.datalocation.Locationservice with the property "type" equal toLocation.INSTANCE_FILTER.- Returns:
- the location of the platform's instance data area or
nullif none - Since:
- 3.0
- See Also:
-
getBundleGroupProviders
Returns the currently registered bundle group providers.Clients are also able to acquire the
IBundleGroupProviderservice and query it for the registered bundle group providers.- Returns:
- the currently registered bundle group providers
- Since:
- 3.0
-
getPreferencesService
Return the interface into the preference mechanism. The returned object can be used for such operations as searching for preference values across multiple scopes and preference import/export.Clients are also able to acquire the
IPreferencesServiceservice via OSGi mechanisms and use it for preference functions.- Returns:
- an object to interface into the preference mechanism
- Since:
- 3.0
-
getProduct
Returns the product which was selected when running this Eclipse instance ornullif none- Returns:
- the current product or
nullif none - Since:
- 3.0
-
registerBundleGroupProvider
Registers the given bundle group provider with the platform.Clients are also able to use the
IBundleGroupProviderservice to register themselves as a bundle group provider.- Parameters:
provider- a provider to register- Since:
- 3.0
-
unregisterBundleGroupProvider
De-registers the given bundle group provider with the platform.Clients are also able to use the
IBundleGroupProviderservice mechanism for unregistering themselves.- Parameters:
provider- a provider to de-register- Since:
- 3.0
- See Also:
-
getConfigurationLocation
Returns the location of the configuration information used to run this instance of Eclipse. The configuration area typically contains the list of plug-ins available for use, various settings (those shared across different instances of the same configuration) and any other such data needed by plug-ins.nullis returned if the platform is running without a configuration location.This method is equivalent to acquiring the
org.eclipse.osgi.service.datalocation.Locationservice with the property "type" equal toLocation.CONFIGURATION_FILTER.- Returns:
- the location of the platform's configuration data area or
nullif none - Since:
- 3.0
- See Also:
-
getUserLocation
Returns the location of the platform's user data area. The user data area is a location on the system which is specific to the system's current user. By default it is located relative to the location given by the System property "user.home".nullis returned if the platform is running without an user location.This method is equivalent to acquiring the
org.eclipse.osgi.service.datalocation.Locationservice with the property "type" equal toLocation.USER_FILTER.- Returns:
- the location of the platform's user data area or
nullif none - Since:
- 3.0
- See Also:
-
getInstallLocation
Returns the location of the base installation for the running platformnullis returned if the platform is running without a configuration location.This method is equivalent to acquiring the
org.eclipse.osgi.service.datalocation.Locationservice with the property "type" equal toLocation.INSTALL_FILTER.- Returns:
- the location of the platform's installation area or
nullif none - Since:
- 3.0
- See Also:
-
isFragment
Checks if the specified bundle is a fragment bundle.Clients are also able to acquire the
PackageAdminservice to query if the given bundle is a fragment by asking for the bundle type and checking against constants on the service interface.- Parameters:
bundle- the bundle to query- Returns:
- true if the specified bundle is a fragment bundle; otherwise false is returned.
- Since:
- 3.0
-
getFragments
Returns an array of attached fragment bundles for the specified bundle. If the specified bundle is a fragment thennullis returned. If no fragments are attached to the specified bundle thennullis returned.Clients are also able to acquire the
PackageAdminservice and query it for the fragments of the given bundle.- Parameters:
bundle- the bundle to get the attached fragment bundles for.- Returns:
- an array of fragment bundles or
nullif the bundle does not have any attached fragment bundles. - Since:
- 3.0
-
getBundle
Returns the resolved bundle with the specified symbolic name that has the highest version. If no resolved bundles are installed that have the specified symbolic name then null is returned.Clients are also able to acquire the
PackageAdminservice and query it for the bundle with the specified symbolic name. Clients can ask the service for all bundles with that particular name and then determine the one with the highest version. Note that clients may want to filter the results based on the state of the bundles.Note that looking up a Bundle by its symbolic name is less efficient than looking up a Bundle by a class loaded by that bundle. Callers should consider whether or not it is more appropriate to use
FrameworkUtil.getBundle(Class)instead.Note also that if the purpose of looking up the Bundle in order to log a message, then it would be more appropriate to use the direct
getLog(Class)instead- Parameters:
symbolicName- the symbolic name of the bundle to be returned.- Returns:
- the bundle that has the specified symbolic name with the highest
version, or
nullif no bundle is found. - Since:
- 3.0
-
getBundles
Returns all bundles with the specified symbolic name. If no resolved bundles with the specified symbolic name can be found,nullis returned. If the version argument is not null then only the Bundles that have the specified symbolic name and a version greater than or equal to the specified version are returned. The returned bundles are ordered in descending bundle version order.Clients are also able to acquire the
PackageAdminservice and query it for all bundle versions with the given symbolic name, after turning the specific version into a version range. Note that clients may want to filter the results based on the state of the bundles.- Parameters:
symbolicName- the symbolic name of the bundles that are to be returned.version- the version that the return bundle versions must match, ornullif no version matching is to be done.- Returns:
- the array of Bundles with the specified name that match the specified
version and match rule, or
nullif no bundles are found.
-
getHosts
Returns an array of host bundles that the specified fragment bundle is attached to ornullif the specified bundle is not attached to a host. If the bundle is not a fragment bundle thennullis returned.Clients are also able to acquire the
PackageAdminservice and query it for the hosts for the given bundle.- Parameters:
bundle- the bundle to get the host bundles for.- Returns:
- an array of host bundles or null if the bundle does not have any host bundles.
- Since:
- 3.0
-
isRunning
public static boolean isRunning()Returns whether the platform is running.- Returns:
trueif the platform is running, andfalseotherwise- Since:
- 3.0
-
knownOSArchValues
Returns a list of known system architectures.Note that this list is not authoritative; there may be legal values not included in this list. Indeed, the value returned by
getOSArchmay not be in this list. Also, this list may change over time as Eclipse comes to run on more operating environments.- Returns:
- the list of system architectures known to the system
- Since:
- 3.0
- See Also:
-
knownOSValues
Returns a list of known operating system names.Note that this list is not authoritative; there may be legal values not included in this list. Indeed, the value returned by
getOSmay not be in this list. Also, this list may change over time as Eclipse comes to run on more operating environments.- Returns:
- the list of operating systems known to the system
- Since:
- 3.0
- See Also:
-
knownPlatformLineSeparators
Returns a map of known platform line separators. The keys are translated names of platforms and the values are their associated line separator strings.- Returns:
- a map of platform to their line separator string
- Since:
- 3.1
-
knownWSValues
Returns a list of known windowing system names.Note that this list is not authoritative; there may be legal values not included in this list. Indeed, the value returned by
getWSmay not be in this list. Also, this list may change over time as Eclipse comes to run on more operating environments.- Returns:
- the list of window systems known to the system
- Since:
- 3.0
- See Also:
-
inDebugMode
public static boolean inDebugMode()Returnstrueif the platform is currently running in debug mode. The platform is typically put in debug mode using the "-debug" command line argument.Clients are also able to acquire the
EnvironmentInfoservice and query it to see if they are in debug mode.- Returns:
- whether or not the platform is running in debug mode
- Since:
- 3.0
-
inDevelopmentMode
public static boolean inDevelopmentMode()Returnstrueif the platform is currently running in development mode. That is, if special procedures are to be taken when defining plug-in class paths. The platform is typically put in development mode using the "-dev" command line argument.Clients are also able to acquire the
EnvironmentInfoservice and query it to see if they are in development mode.- Returns:
- whether or not the platform is running in development mode
- Since:
- 3.0
-
getSystemCharset
Retrieves the system encoding (Charset) based on the locale set in the current user environment.Note: the return value is not influenced by the
-Dfile.encodingsystem property and is not meant to be used for file encoding in general (there is a workspace specificIContainer.getDefaultCharset()API for that).This method should be used if the original system encoding is required (which is not necessarily the encoding used by JVM to save files). It can for example be used to properly encode Java Command-Line Argument Files or to encode other platform specific data.
- Returns:
- system encoding, never null. In case the detection fails, returns
Charset.defaultCharset(), which is alwaysUTF-8on Java 18 and later. - Since:
- 3.26
- See Also:
-
ARCH_X86_64instead.