Bug 125526 [IDE] BuildUtilities.java's extractProjects() method does not consider ResourceMapping cases
Eclipse: 3.2M4 Plugin: org.eclipse.ui.ide Class: org\eclipse\ui\internal\ide\actions\BuildUtilities.java Here is a REVISED extractProjects() method which solves the problem (for your consideration) : ///// CODE START /** * Extracts the selected projects from a selection. * * @param selection The selection to analyze * @return The selected projects */ public static IProject[] extractProjects(Object[] selection) { HashSet projects = new HashSet(); for (int i = 0; i < selection.length; i++) { if (selection[i] instanceof IResource) { projects.add(((IResource) selection[i]).getProject()); } else if (selection[i] instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) selection[i]; IResource resource = (IResource) adaptable.getAdapter(IResource.class); if (resource != null) projects.add(resource.getProject()); } else { //attempt to find resource mapping for selection IAdapterManager am = Platform.getAdapterManager(); ResourceMapping rm =(ResourceMapping)am.getAdapter(selection[i], ResourceMapping.class); if (rm != null) { IProject[] theProjects = rm.getProjects(); for(int j=0;j<theProjects.length;j++){ projects.add(theProjects[j]); } } } } return (IProject[]) projects.toArray(new IProject[projects.size()]); } ///// CODE END
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java
Object rm = am.getAdapter(selection[i], ResourceMapping.class);
				if (rm instanceof ResourceMapping) {
					IProject[] theProjects = ((ResourceMapping)rm).getProjects();					
					for(int j=0;j<theProjects.length;j++){
						   projects.add(theProjects[j]);						
					}
				}
			}
		}
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
	}
	/**
	 * Finds and returns the selected projects in the given window
	 * 
	 * @param window The window to find the selection in
	 * @return The selected projects, or an empty array if no selection could be found.
	 */
	public static IProject[] findSelectedProjects(IWorkbenchWindow window) {
		if (window == null)
			return new IProject[0];
		ISelection selection = window.getSelectionService().getSelection();
		IProject[] selected = null;
		if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
			selected = extractProjects(((IStructuredSelection) selection).toArray());
		} else {
			
			IWorkbenchPart part = window.getPartService().getActivePart();
			if (part instanceof IEditorPart) {
				IEditorPart editor = (IEditorPart) part;
				IFile file = ResourceUtil.getFile(editor.getEditorInput());