Bug 55765 NPE in new BuildSetAction
I20040322 1) Select a project in the synchronize view 2) Project > Clean java.lang.NullPointerException at java.lang.Throwable.<init>(Throwable.java) at java.lang.Throwable.<init>(Throwable.java) at java.lang.NullPointerException.<init>(NullPointerException.java:60) at org.eclipse.ui.internal.ide.actions.BuildSetAction.extractProjects(BuildSetAction.java:47) at org.eclipse.ui.internal.ide.actions.BuildCleanAction.run(BuildCleanAction.java:39) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:550) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:502) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:435) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1488) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1462) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:259) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:262) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:213) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:115) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41) at java.lang.reflect.Method.invoke(Method.java:386) at org.eclipse.core.launcher.Main.basicRun(Main.java:315) at org.eclipse.core.launcher.Main.run(Main.java:740) at org.eclipse.core.launcher.Main.main(Main.java:724)
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildSetAction.java
* from a selection
	 */
	protected 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);
				projects.add(resource.getProject());
			}
		}
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
	}
	/**
	 * Creates a new action that builds the provided working set when run
	 */
	public BuildSetAction(IWorkingSet set, IWorkbenchWindow window, IActionBarConfigurer actionBars) {
		super(set == null ? "" : set.getName(), AS_RADIO_BUTTON); 
		this.window = window;
		this.actionBars = actionBars;
		this.workingSet = set;
	}
	/**
	 * Returns the working set that this instance is building
	 */
	public IWorkingSet getWorkingSet() {
		return workingSet;
	}