Community
Participate
Working Groups
Build Identifier: 20110615-0604 After moving on Helios I am getting wrong PRE_BUILD and POST_BUILD event behaviour in my plugins. Instead of getting IProject or IWorkspace objects in event.getSource() depending on the scope of the build I am always getting IWorkspace objects. Reproducible: Always Steps to Reproduce: 1. startup class IWorkspace workspace = ResourcesPlugin.getWorkspace(); IResourceChangeListener listener = new RessourceChangeListener(); workspace.addResourceChangeListener(listener, IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_BUILD); 2. Listener: Now in the listener itself following code gets called: public void resourceChanged(IResourceChangeEvent event) { System.out.println("source: "+event.getSource().getClass().toString()); } 3. I do always get IWorkspace independent from what I build.
I am sorry for the typo, the bug is for INDIGO.
This is dependent on how the build is run. If your build action calls IProject#build, the source will be a project. If you build using IWorkspace#build, the source will be at the workspace level. In Indigo the default build action uses IWorkspace API to build a project and its references. For each build invocation, only one PRE_BUILD and POST_BUILD are fired. As a workspace build invocation may build more than one project, the build scope / event source will be at the IWorkspace level. It's not correct to rely on the build event source being an IProject, as IProject#build is one of 3 methods which will cause a project to be built (the others are: auto-build and Workspace build). So to work out whether a project is being built you really need to look at the delta, not the source. See also bug 341838 comment 2
Well, I noticed, that my code is not working any longer since the scope is now at IWorkspace. Is it maybe a problem with the new CDT s.t. even the build project trigger triggers IWorkspace build?
It might have to build references as well. Hence it's a workspace scoped build.
i am trying to traverse Delta event.getDelta().accept(new IResourceDeltaVisitor(){ public boolean visit(IResourceDelta delta) throws CoreException { System.out.println(delta.getResource().getProject().getName()); return true; } }); the inner function is never called, delta seems to be empty, am i doing something wrong?
This behavior still occurs in Juno. It seems the delta is sometimes empty after invoking a build with the hammer icon. Also, it seems to depend on the current focus. If I select the project in Project Explorer and build, the delta contains the project. If I select a view, such as the console view, and build, the delta is empty.
I forgot to mention that I'm using CDT to build. So I don't know if this is a CDT problem or a platform problem.
CDT please comment.
The delta issue sounds different. There may be no resource changes when the build was requested.