In processing command line, can't find just-opened TopComponents
Greg Bullock <[email protected]> Sun, 20 Jul 2025 12:30:30 -0700
| Newsgroups | gmane.comp.java.ide.netbeans.user |
|---|---|
| Organization | NWRA, Inc. |
| Message-ID | <[email protected]> |
(Using Netbeans 8.2.) There seems to be a timing problem at startup in
my Netbeans Platform application.
The application needs to open image files specified on the command line,
then display on top of those images the information read from any
additional "overlay" files specified on the command line with a named
argument "--overlay".
Some of this is working as intended. The DataLoader finds the image
DataObjects and successfully opens the files in the appropriate editor.
Then, with a CommandLineProcessor class
@ServiceProvider(service=OptionProcessor.class)
publicclassCommandLineProcessorextendsOptionProcessor{
...
}
the additional "--overlay" files are parsed from the command line
successfully.
The overlay files get read, but alas, their contents never get overlayed
on the images. When the overlay file's DataObjects's method gets called
to read their content, it cannot find the TopComponent for the
associated image file on which the information should be displayed.
Its search through all opened TopComponents, using
WindowManager.getDefault().getRegistry().getOpened(), finds other
TopComponents (such as Notifications, Project, and maybe some others),
but not TopComponents for the just-opened image files.
Suspecting that the overlaying is happening before the image
TopComponents get registered, I use
WindowManager.getDefault().invokeWhenUIReady(...) to defer the
overlaying until after all the image files are opened and the UI has
stabilized. Alas, this doesn't suffice.
What could be wrong here? Is there a way defer the overlay processing
until after all the image TopComponents get registered (assuming that's
the problem)?
--
Greg Bullock
NorthWest Research Associates
149 Bonifacio Place, Suite 200
Monterey, CA 93940
(831) 582-4907
[email protected]
smime.p7s
(application/pkcs7-signature, 4 KB) - not displayed