[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: Resource Changes at Start-Up
|
One way of doing this is to declare a Project nature and in the nature's
configure() method you update the buildspec of the project to have your
builder in the proper order relative to the other builders. You have to
arrange to have your project nature added to the projects in question. How
you do this depends on the context. If your wizard is creating the project,
do it in there. If this is a random project from somewhere else, you need
to have a user story which talks about "introducing the project to your
world" (aka, adding your nature). Both scenarios have come up in tools
being written to date.
Jeff
"Kevin Bauer" <kmbauer@xxxxxxxxxx> wrote in message
news:9bk8vt$ifa$1@xxxxxxxxxxxxxxxx
> 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?
> > >
>
>
>
>
>