[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Resource Changes at Start-Up

If I make this a builder how can I make sure I get run before the java
builder?  Their plugin is initialized before us.


Jeff McAffer wrote:

> Kevin,

> As you observed, resource change listeners get notified from the time they
> are registered.  Your situation is interesting because it highlights this as
> well as the fact that one cannot rely on their plugins being run everytime
> the platform is run.  For example, what happens if the user starts up the
> platform and doesn't do work involving your plugin?  Its not needed and so
> will not be activated.  They may still change resources in which you are
> interested.

> The easiest way to handle this is to use the ISaveParticipant facilities.
> This allows you to register your desire for a delta the next time YOU are
> started (see ISaveContext.needDelta()).  The next time your plugin is run,
> it will have an ISavedState available to it.  Using
> ISavedContext.processResourceChangeEvents() you can get access to the delta
> between the last time YOU saved and the time YOU are starting. (ok, enough
> emphasis...)

> Note that this mechanism reserves the right to forget very old states and so
> may give you a null delta.  In this case you simply assume that it is the
> first time you've run and check all your states to ensure consistency.  You
> presumably need this capability anyway.

> You could also investigate IncrementalProjectBuilders but I don't think this
> is applicable here.

> Hope that helps

> Jeff

> "Kevin Bauer" <kmbauer@xxxxxxxxxx> wrote in message
> news:9bfokk$44k$1@xxxxxxxxxxxxxxxx
> > I have a resource change listener that notifies me when people
> > add/remove/change jars in my lib directory.  I need this so that I can
> > modify my Java class path on these changes.  I am currently initializing
> > this class through my plugin's statup.  However, people can make changes
> > to my lib directories before the WebTools plugin is loaded and my listener
> > is not notified.  Is there any way to register a ResourceChangeListener to
> > catch the initial resource changes?
> >