IResourceChangeListener adding at IDE startup [message #272603] |
Thu, 23 September 2004 22:02  |
Eclipse User |
|
|
|
Hi,
I want to do certain actions when the resource change event is fired. I
can add the listener and everything is fine. But how can I do that at the
startup of Eclipse as I understand my plugin does not get initialized at
the stratup bcos of Eclipses lazy initialization technique of plugin.
Is there any way I can add my IResourceChangeListener at the startup of
Eclipse?
Any Help is appreciated.
Thanks,
Sid
|
|
|
Re: IResourceChangeListener adding at IDE startup [message #272634 is a reply to message #272603] |
Fri, 24 September 2004 10:09  |
Eclipse User |
|
|
|
Sid,
There are two ways to appraoch this.
1) If you just need to know about all changes that occur but don't need
to react to them immediately, you can register as a save participant.
When a plugin is registered as a save particpant when it starts, it
recieves a delta of all the changes that have occurred since Eclipse
started. See the ISaveParticipant interface and the
IWorkspace#addSaveParticpant method for more details. Here's a code
snipet on how to getthe delta from Eclipse startup to plugin startup
IWorkspace ws = ResourcesPlugin.getWorkspace();
ISavedState ss = ws.addSaveParticipant(CVSProviderPlugin.getPlugin(), this);
if (ss != null) {
ss.processResourceChangeEvents((IResourceChangeListener)this );
}
2) If you need to react to changes immediatly, you can use the startup
hock. Have a look at the IStartup interface and the documentation for
the org.eclipse.ui.startup extension point. You probably still need to
do step 1) since the startup hooks are run in the background so they do
not slow down workbench startup so there is still the possibility of a
missed delta.
Michael
Sid wrote:
> Hi,
>
> I want to do certain actions when the resource change event is fired. I
> can add the listener and everything is fine. But how can I do that at the
> startup of Eclipse as I understand my plugin does not get initialized at
> the stratup bcos of Eclipses lazy initialization technique of plugin.
>
> Is there any way I can add my IResourceChangeListener at the startup of
> Eclipse?
>
> Any Help is appreciated.
>
> Thanks,
>
> Sid
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03720 seconds