Bug 107377 [GlobalActions] NPE deleting a file
I got an NPE when I tried to delete a file from the synchronize view. The delete in Eclipse may have coincided with a delete of the file in the file system as it was a temp file from an application that was closing at the time I deleted the file in Eclipse. java.lang.NullPointerException at org.eclipse.ui.actions.ReadOnlyStateChecker.checkReadOnlyResources (ReadOnlyStateChecker.java:154) at org.eclipse.ui.actions.ReadOnlyStateChecker.checkReadOnlyResources (ReadOnlyStateChecker.java:108) at org.eclipse.ui.actions.DeleteResourceAction.getResourcesToDelete (DeleteResourceAction.java:551) at org.eclipse.ui.actions.DeleteResourceAction.run (DeleteResourceAction.java:492) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent (BaseSelectionListenerAction.java:167) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:222) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:117) at org.eclipse.core.commands.Command.execute(Command.java:311) at org.eclipse.core.commands.ParameterizedCommand.execute (ParameterizedCommand.java:396) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand (WorkbenchKeyboard.java:459) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press (WorkbenchKeyboard.java:781) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent (WorkbenchKeyboard.java:828) at org.eclipse.ui.internal.keys.OutOfOrderListener.handleEvent (OutOfOrderListener.java:76) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:883) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:907) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:892) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:920) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:916) at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1515) at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3376) at org.eclipse.swt.widgets.Tree.WM_KEYDOWN(Tree.java:3052) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3087) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:2908) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3772) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1680) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2763) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1734) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1698) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/ReadOnlyStateChecker.java
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.actions;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
/**
 * The ReadOnlyStateChecker is a helper class that takes a set of resource
 * some of which may be read only and queries the user as to whether or
 * not they wish to continue the operation on it.
 */
public class ReadOnlyStateChecker {