need event when user loads plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

need event when user loads plugin

mccorb-2
When a user loads/enable/disables a plugin from the tools->plugins dialog in my app I want to get an event that tells me the list of valid plugins has changed so that I can take the appropriate action.

How do a register to receive an event? I looked through the classes in the org.netbeans.api.autoupdate package and nothing looked like it would send an event.




Reply | Threaded
Open this post in threaded view
|

Re: need event when user loads plugin

Boris Heithecker
Hi,

an instance of ModuleInfo is available in global lookup for each installed module, so simply listen to changes in default lookup: 

        final Lookup.Result<ModuleInfo> lr = Lookup.getDefault().lookupResult(ModuleInfo.class);
        lr.addLookupListener(e -> {
            ....
        });

Boris

2017-05-04 17:17 GMT+02:00 mccorb <[hidden email]>:
When a user loads/enable/disables a plugin from the tools->plugins dialog in my app I want to get an event that tells me the list of valid plugins has changed so that I can take the appropriate action.

How do a register to receive an event? I looked through the classes in the org.netbeans.api.autoupdate package and nothing looked like it would send an event.







--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34