Package org.eclipse.jface.resource
Class JFaceResources
java.lang.Object
org.eclipse.jface.resource.JFaceResources
Utility methods to access JFace-specific resources.
All methods declared on this class are static. This class cannot be instantiated.
The following global state is also maintained by this class:
- a font registry
- a color registry
- an image registry
- a resource bundle
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The symbolic font name for the banner font (value"org.eclipse.jface.bannerfont"
).static final String
The symbolic font name for the standard font (value"org.eclipse.jface.defaultfont"
).static final String
The symbolic font name for the dialog font (value"org.eclipse.jface.dialogfont"
).static final String
The symbolic font name for the header font (value"org.eclipse.jface.headerfont"
).static final String
The symbolic font name for the text font (value"org.eclipse.jface.textfont"
).static final String
Deprecated.This font is not in usestatic final String
Deprecated.This font is not in use -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns the formatted message for the given key in JFace's resource bundle.static Font
Returns the JFace's banner font.static ResourceBundle
Returns the resource bundle for JFace itself.static ColorRegistry
Returns the color registry for JFace itself.static Font
Returns JFace's standard font.static FontDescriptor
Returns the descriptor for JFace's standard font.static Font
Returns the JFace's dialog font.static FontDescriptor
Returns the descriptor for JFace's dialog font.static Font
Returns the font in JFace's font registry with the given symbolic font name.static FontDescriptor
getFontDescriptor
(String symbolicName) Returns the font descriptor for in JFace's font registry with the given symbolic name.static FontRegistry
Returns the font registry for JFace itself.static Font
Returns the JFace's header font.static FontDescriptor
Returns the descriptor for JFace's header font.static Image
Returns the image in JFace's image registry with the given key, ornull
if none.static ImageRegistry
Returns the image registry for JFace itself.static ResourceManager
Returns the ResourceManager for the current display.static ResourceManager
getResources
(Display toQuery) Returns the global resource manager for the given displaystatic String
Returns the resource object with the given key in JFace's resource bundle.static String[]
getStrings
(String[] keys) Returns a list of string values corresponding to the given list of keys.static Font
Returns JFace's text font.static FontDescriptor
Returns the descriptor for JFace's text font.static Font
Deprecated.This font is not in usestatic LocalResourceManager
managerFor
(Control owner) Creates a local registry that wraps the ResourceManager for the current display.static void
setFontRegistry
(FontRegistry registry) Sets JFace's font registry to the given value.
-
Field Details
-
BANNER_FONT
The symbolic font name for the banner font (value"org.eclipse.jface.bannerfont"
).- See Also:
-
DEFAULT_FONT
The symbolic font name for the standard font (value"org.eclipse.jface.defaultfont"
).- See Also:
-
DIALOG_FONT
The symbolic font name for the dialog font (value"org.eclipse.jface.dialogfont"
).- See Also:
-
HEADER_FONT
The symbolic font name for the header font (value"org.eclipse.jface.headerfont"
).- See Also:
-
TEXT_FONT
The symbolic font name for the text font (value"org.eclipse.jface.textfont"
).- See Also:
-
VIEWER_FONT
Deprecated.This font is not in useThe symbolic font name for the viewer font (value"org.eclipse.jface.viewerfont"
).- See Also:
-
WINDOW_FONT
Deprecated.This font is not in useThe symbolic font name for the window font (value"org.eclipse.jface.windowfont"
).- See Also:
-
-
Method Details
-
format
Returns the formatted message for the given key in JFace's resource bundle.- Parameters:
key
- the resource nameargs
- the message arguments- Returns:
- the string
-
getBannerFont
Returns the JFace's banner font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT)
- Returns:
- the font
-
getBundle
Returns the resource bundle for JFace itself. The resource bundle is obtained fromResourceBundle.getBundle("org.eclipse.jface.jface_nls")
.Note that several static convenience methods are also provided on this class for directly accessing resources in this bundle.
- Returns:
- the resource bundle
-
getColorRegistry
Returns the color registry for JFace itself.- Returns:
- the
ColorRegistry
. - Since:
- 3.0
-
getResources
Returns the global resource manager for the given display- Parameters:
toQuery
- display to query- Returns:
- the global resource manager for the given display
- Since:
- 3.1
-
getResources
Returns the ResourceManager for the current display. May only be called from a UI thread.- Returns:
- the global ResourceManager for the current display
- Since:
- 3.1
-
getDefaultFont
Returns JFace's standard font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT)
- Returns:
- the font
-
getDefaultFontDescriptor
Returns the descriptor for JFace's standard font. Convenience method equivalent toJFaceResources.getFontRegistry().getDescriptor(JFaceResources.DEFAULT_FONT)
- Returns:
- the font
- Since:
- 3.3
-
getDialogFont
Returns the JFace's dialog font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT)
- Returns:
- the font
-
getDialogFontDescriptor
Returns the descriptor for JFace's dialog font. Convenience method equivalent toJFaceResources.getFontRegistry().getDescriptor(JFaceResources.DIALOG_FONT)
- Returns:
- the font
- Since:
- 3.3
-
getFont
Returns the font in JFace's font registry with the given symbolic font name. Convenience method equivalent toJFaceResources.getFontRegistry().get(symbolicName)
If an error occurs, return the default font.- Parameters:
symbolicName
- the symbolic font name- Returns:
- the font
-
getFontDescriptor
Returns the font descriptor for in JFace's font registry with the given symbolic name. Convenience method equivalent toJFaceResources.getFontRegistry().getDescriptor(symbolicName)
If an error occurs, return the default font.- Parameters:
symbolicName
- the symbolic font name- Returns:
- the font descriptor (never null)
- Since:
- 3.3
-
getFontRegistry
Returns the font registry for JFace itself. If the value has not been established by an earlier call tosetFontRegistry
, is it initialized tonew FontRegistry("org.eclipse.jface.resource.jfacefonts")
.Note that several static convenience methods are also provided on this class for directly accessing JFace's standard fonts.
- Returns:
- the JFace font registry
-
getHeaderFont
Returns the JFace's header font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.HEADER_FONT)
- Returns:
- the font
-
getHeaderFontDescriptor
Returns the descriptor for JFace's header font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.HEADER_FONT)
- Returns:
- the font descriptor (never null)
- Since:
- 3.3
-
getImage
Returns the image in JFace's image registry with the given key, ornull
if none. Convenience method equivalent toJFaceResources.getImageRegistry().get(key)
- Parameters:
key
- the key- Returns:
- the image, or
null
if none
-
getImageRegistry
Returns the image registry for JFace itself.Note that the static convenience method
getImage
is also provided on this class.- Returns:
- the JFace image registry
-
getString
Returns the resource object with the given key in JFace's resource bundle. If there isn't any value under the given key, the key is returned.- Parameters:
key
- the resource name- Returns:
- the string
-
getStrings
Returns a list of string values corresponding to the given list of keys. The lookup is done withgetString
. The values are in the same order as the keys.- Parameters:
keys
- a list of keys- Returns:
- a list of corresponding string values
-
getTextFont
Returns JFace's text font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)
- Returns:
- the font
-
getTextFontDescriptor
Returns the descriptor for JFace's text font. Convenience method equivalent toJFaceResources.getFontRegistry().getDescriptor(JFaceResources.TEXT_FONT)
- Returns:
- the font descriptor (never null)
- Since:
- 3.3
-
getViewerFont
Deprecated.This font is not in useReturns JFace's viewer font. Convenience method equivalent toJFaceResources.getFontRegistry().get(JFaceResources.VIEWER_FONT)
- Returns:
- the font
-
setFontRegistry
Sets JFace's font registry to the given value. This method may only be called once; the call must occur beforeJFaceResources.getFontRegistry
is invoked (either directly or indirectly).- Parameters:
registry
- a font registry
-
managerFor
Creates a local registry that wraps the ResourceManager for the current display. Anything allocated by this registry will be automatically cleaned up with the given control is disposed. Note that registries created in this way should not be used to allocate any resource that must outlive the given control. shortcut forLocalResourceManager(JFaceResources.getResources(), owner)
- Parameters:
owner
- control whose disposal will trigger cleanup of everything in the registry.- Returns:
- LocalResourceManager
- Since:
- 3.32
-