Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Getting the project for a PRE_BUILD event

Hi Phil,

This is a bit of an issue, see:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350833#c2

I guess the real problem is that you can't reliably use this to discover which project is about to be built.  You can iterate over the delta to see which projects have changes, as those will end up being built.  But PRE_BUILD is only called once per build, not once per project being built, so that may not give you precisely what you want... 

A better bet might be to override the build action, and intercept the event at source.  Alternatively, at the other end, add some hooks into CDT to allow notification when the CDT builder is about to run.

Cheers,
James

On 27 July 2012 14:50, Phil Mason <phil.mason@xxxxxxxxxxxx> wrote:

Hi all,

 

I’ve registered a PRE_BUILD listener and I need to work out which project is being built so I can make some changes (if needed) to the project environment. I know I can’t use getResource() on PRE_BUILD events but if I use getSource() then I always seem to get a workspace. My code looks something like this:

 

public void resourceChanged(IResourceChangeEvent event) {

                                Object res = event.getSource();

                                if(res instanceof IProject)

                                {

                                                // Some code here

}

}

 

Can anybody point me at how to get the right project.

 

Thanks

 

Phil


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top