Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] problems with registry change events

Hi Oleg,

Thanks for your reply. I have tried this and this works for me as well. But I had also expected registry events being fired when eclipse starts up and the extension registry is populated. BTW, I start eclipse with the -clean option to prevent caching. At which point is the event delivery mechanism switched on? And is there a life cycle event signaling when this happens?

Thanks, Jens


Quoting Oleg Besedin <obesedin@xxxxxxxxxx>:

Hi Jens,
It does work for me. Using your code:

1 Create a new bundle that contributes to the registry - say, using "Hello
world" template for the new plug-in project wizard
2 Add "-console" argument to the Eclipse launch configuration that you are
using
3 Start it
4 Use "ss" command in the console to make sure your tracking bundle is
started and to find out the ID of the bundle from the step 1
5. Type "refresh <bundle_id_from_step_1> in the console - you'll see the
events.

Thanks,
Oleg





Jens Dietrich <j.b.dietrich@xxxxxxxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx
10/01/2008 04:53 PM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>


To
equinox-dev@xxxxxxxxxxx
cc

Subject
[equinox-dev] problems with registry change events






Hi,

I am working on a program that performs some additional integrity checks
between bundles collaborating through extension points and extensions. I
want to trigger verification whenever new extensions or extension points
are registered. I have done a little spike: I wrote a plugin that starts
early (by adding it to config.ini), and added the following code to the
start method in the Activator class (the Activator also implements
IRegistryChangeListener):

private boolean initialized = false;
public void registryChanged(IRegistryChangeEvent e) {
    System.out.println("registry changed");
}
public void start(final BundleContext context) throws Exception {
    super.start(context);
    System.out.println("activating");
    plugin = this;
    BundleListener l = new BundleListener() {
        public void bundleChanged(BundleEvent e) {
            System.out.println("bundle changed:
"+e.getBundle().getSymbolicName());
            if (!initialized && Platform.getExtensionRegistry()!=null) {

Platform.getExtensionRegistry().addRegistryChangeListener(Activator.this);
                System.out.println("registry loaded");
                initialized = true;
            }
        }
    };
    context.addBundleListener(l);
}


The idea is to wait for the extension registry, and once it becomes
available to start listening for registry change events. The output on
the console is the following:

activating
bundle changed: nz.ac.massey.treaty.spikes.events.main
registry loaded
bundle changed: org.eclipse.jface
bundle changed: org.eclipse.ui

... (more bundle changed: .. - )


It seems that registryChanged is never invoked. Even if I install a
plugin later (once the eclipse instance is running) from a local update
site, the method is never called (no print out, I have tried to debug as
well). Why is this?

Any help is appreciated!

Jens

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev






Back to the top