[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: questions re a non-ui plugin

Derek Morris wrote:
Hi,

I have a plugin (singleton) that offers various common services to several other
plugins. It does not have a GUI itself. It is also 'standalone' in that it does
not interact with Eclipse directly, except load/saveState() (see below). My
questions:


- Can I get it to start/initialise/loadState() without direct calls from each of
the plugins that use it

Hmm...I guess you mean "with calls to load the plugin explicitly"; these common services your plugin implements must be called from you plugins right? If so, then your ticket is in MANIFEST.MF, under the PDE this is
shown when you bring up plugin.xml. You can set Eclipse-LazyStart: true class loading trigger a call to your start(BundleContext). Beware if you create or use threading.


- having done that, how do I get it to saveState() when closing Eclipse?

You can listen for PRE_CLOSE events on projects in
IResourceChangeListener listener = new MyResourceChangeReporter();
ResourcesPlugin.getWorkspace().addResourceChangeListener(
listener, IResourceChangeEvent.PRE_CLOSE);
That way if you plugin only deals with some projects it does the right thing for them. I guess there is an event for workspace and workbench close, but most plugins outside of eclipse proper should be per project I suppose.



Thanks