This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
We have our RCP application and wrote a license manager that enables or disables modules depending on a license file. To do so we have to ask the user for a license at the first run of our application. In a subsequent session we simply apply the saved license settings. Steps at first run: 1) disable all modules that need a license to be enabled 2) ask the user for a license 3) check the license and, if all is OK, enable the licensed modules and leave disabled the others (if any). These operations done at first run seem causing some problem in NB code (and also in our code, see #156822 likely fixed using Presenter.Toolbar suggestion), during the same session. For example, say that a module (executableoptions), that can be disabled due to licensing, registers an Option panel in the layer.xml. If the disable operation is done when the Options windows is open, the merged layer.xml content is changing, but it seems that the Options window is not listening to that layer.xml change. Therefore the Options window still shows the Option panel registered by executableoptions and when the user try to switch to that Option panel, an exception will be thrown. Another problem is that in response to a lookup result change event, some NB code is doing a call to BaseKit.install() from a RequestProcessor thread: so BaseKit.install() is complaining, because it has to be called from AWT thread. I'm going to attach two stack traces about those exceptions.
Created attachment 75889 [details] NoClassDefFoundError when executableoptions module has been disabled with opened Options window
Created attachment 75890 [details] AssertionError: BaseKit.install() incorrectly called from non-AWT thread, happened when disabling a module with opened Options window
To prevent exceptions the options window is closed when panels change. AWT Thread exception was fixed in issue 157434. http://hg.netbeans.org/core-main/rev/f1990ce17736
Since we disable and enable the modules from a license manager option panel (then while Option dialog is open), is there a way to listen to layer.xml changes and handle them, instead of abruptly close the Options dialog? Thanks in advance for the support.
This is something unusual. The place for enabling/disabling modules is the plugin manager. When module is selected to be enabled, licence is shown. Your approach is inverse. Anyway, it is possible to listen to layer changes but options dialog has to be rebuild from scratch. So, it is not possible to selectively remove one panel.
Likely you misunderstood me: we built a license manager to protect our RCP application. This license manager is a plugin that enables/disables other modules if the user has/hasn't authorization to use them. GUI of our Licence Manager is in an options panel, thus when it disables/enables modules the Options dialog has to remain opened. Now with your fix, disabling a module, that registers an OptionsCategory (and OptionsPanelController, etc.), will close the whole Options window. However I comprehend that rebuilding from scratch the Options dialog is unfortunately not an option....
Yes, I understand. I just wanted to say that there already exists plugin manager (Tools>Plugins). Now I have no better solution for you than to move your Licence Manager from the options window into dedicated dialog.
Integrated into 'main-golden', will be available in build *200902140319* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/f1990ce17736 User: Jiri Skrivanek <jskrivanek@netbeans.org> Log: #156947 - close dialog when categories change.