Utilities API
Official
Overview of Utilities API module
This module contains general classes needed in NetBeans, extensions to basic JRE contepts, useful methods and other UtilitiesAPI classes.
What is New (see all changes)?
-
Jan 5 '25 Added methods to ImageUtilities, to aid migration from other icon loading methods.
Added new utility methods to ImageUtilities to ease migration from other image loading methods used throughout the NetBeans codebase. Loading icons via ImageUtilities is preferred as it permits alternative SVG versions to be loaded automatically when available.
-
Sep 25 '23 Added methods to query mouse event pseudo-keycodes
Added methods to query the existing pseudo-keycodes assigned to mouse wheel events, and new pseudo-keycodes added for extended mouse buttons.
-
May 26 '23 static method Utilities.findDialogParent overloaded and isModalDialogOpen added
Updated
findDialogParentto ensure that if a modal dialog is open the returned component is in that dialog and added an overload that allows providing a fallback component. AddedisModalDialogOpento determine if there is a modal dialog open. -
Jan 5 '23 Added variant Utilities.actionsForPath with Lookup that produces context-aware actions
Added a variant actionsToPath that instantiates context-bound actions if the registered action(s) implements ContextAwareAction. Improves consistency with actionsToPopup that supports contextual actions.
-
Oct 15 '22 static method Utilities.findDialogParent added
Added
findDialogParentto provide a parent component for standard swing dialog displayers such asJOptionPaneandJFileChooser. This method first checksKeyboardFocusManager, then uses an active frame.
Use Cases
How shall I do or influence logging in NetBeans?
If you are interested in logging from inside your module, or in writing your own log handler or in configuring the whole system, then best place to start is the NetBeans logging guide.
Exported Interfaces
This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...Group of java interfaces
| Interface Name | In/Out | Stability | Specified in What Document? |
|---|---|---|---|
| UtilitiesAPI | Exported | Official | .../org/openide/util/doc-files/api.html |
| DefaultAWTBridge | Exported | Private | .../openide/awt/DefaultAWTBridge.java a class that is looked up in Lookup.getDefault() and if registered can provide better UI elements for Actions. |
| SharedClassObject.setAccessible | Exported | Under Development | .../org/openide/util/SharedClassObject.html used to instantiate subclasses. |
Group of property interfaces
| Interface Name | In/Out | Stability | Specified in What Document? |
|---|---|---|---|
| BrandingSupport | Exported | Official | .../org/openide/util/NbBundle.html which is similar to localization but also supports changes of resorces for application build on top of NetBeans. This is handled by our class NbBundle which reimplements the JDK's standard ResourceBundle to to take branding into the consideration. |
| HelpID | Exported | Standard | org/openide/util/HelpCtx.html read from JComponent.getClientProperty to simulate the standard javahelp behaviour and extract the help id for given component. |
| org.openide.util.SharedClassObject.initialize | Exported | Private |
For purposes of
SystemOption
the
SharedClassObject
handles
getProperty ("org.openide.util.SharedClassObject.initialize")
in a special way, by returning
null if initialization is not running and Boolean.TRUE if
it is.
|
| OpenIDE-Transmodal-Action | Exported | Under Development |
CallbackSystemAction
checks whether action.getValue("OpenIDE-Transmodal-Action")
returns Boolean.TRUE to enable it in dialogs, otherwise
the action is disabled when there is an open dialog.
|
| url | Exported | Private | Images loaded by ImageUtilities.loadImage
defines "url" image property for the loaded image.
|
Group of java.io.File interfaces
| Interface Name | In/Out | Stability | Specified in What Document? |
|---|---|---|---|
| FileLocation | Exported | Under Development |
the JAR file is located in platform cluster under lib/org-openide-util.jar
|
Group of lookup interfaces
| Interface Name | In/Out | Stability | Specified in What Document? |
|---|---|---|---|
| ActionManagerInvocation | Exported | Private |
because of the API separation, CallableSystemAction uses lookup for ActionsBridge
provided by org-openide-actions module
when looking for org.openide.actions.ActionManager implementation.
|
| LookupSharedClassObject | Exported | Under Development | singleton subclasses of SharedClassObject are searched for using Lookup. |
| LookupContextGlobalProvider | Exported | Stable | actionsGlobalContext searches for ContextGlobalProvider in Lookup.getDefault(). The provider is usually provided by window system implementation. |
| LookupErrorManager | Exported | Under Development | ErrorManager delegates its methods to all instances of ErrorManagers found in Lookup |
Implementation Details
Where are the sources for the module?
The sources for the module are in the Apache Git repositories or in the GitHub repositories
What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?
Nothing.
Read more about the implementation in the answers to architecture questions.