Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » IResourceChangeListener adding at IDE startup
IResourceChangeListener adding at IDE startup [message #272603] Fri, 24 September 2004 02:02 Go to next message
S Dix is currently offline S DixFriend
Messages: 43
Registered: July 2009
Member
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 14:09 Go to previous message
Michael Valenta is currently offline Michael ValentaFriend
Messages: 560
Registered: July 2009
Senior Member
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
>
>
Previous Topic:Java 1.5/5.0 now!
Next Topic:how to handle goto from markers
Goto Forum:
  


Current Time: Sun Sep 01 00:21:44 GMT 2024

Powered by FUDForum. Page generated in 0.03795 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top