Bug 108097 [Navigator] AIOOBE when cancelling paste action override question
I20050823-0800 - In the Resource Navigator, create a simple project and create a folder 'f' in it - Copy .project from the project into folder f - Copy f/.project to clipboard, select the project, and paste - A Resource Exists dialog appears - exit the dialog by pressing the Esc key, or by clicking the close box org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException: -1) at org.eclipse.swt.SWT.error(SWT.java:3241) at org.eclipse.swt.SWT.error(SWT.java:3164) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3113) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2768) at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:153) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:303) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:453) at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:261) at org.eclipse.ui.actions.CopyFilesAndFoldersOperation.copyResources(CopyFilesAndFoldersOperation.java:473) at org.eclipse.ui.views.navigator.PasteAction.run(PasteAction.java:135) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167) at org.eclipse.ui.actions.TextActionHandler$PasteActionHandler.runWithEvent(TextActionHandler.java:258) 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.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:550) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:493) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:117) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:920) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:883) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:908) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:893) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:921) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:917) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1231) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3157) at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:2948) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3058) 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:585) 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) Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 at org.eclipse.ui.actions.CopyFilesAndFoldersOperation$1.run(CopyFilesAndFoldersOperation.java:260) at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:150) at org.eclipse.ui.internal.UISynchronizer$1.run(UISynchronizer.java:36) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) ... 52 more
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java
* @param resource resource to cast/adapt
     * @return the resource either casted to or adapted to an IFile.
     * 	<code>null</code> if the resource does not adapt to IFile 
     */
    protected IFile getFile(IResource resource) {
        if (resource instanceof IFile) {
            return (IFile) resource;
        }
        return (IFile) ((IAdaptable) resource).getAdapter(IFile.class);
    }
    /**
     * Returns java.io.File objects for the given file names.
     * 
     * @param fileNames files to return File object for.
     * @return java.io.File objects for the given file names.
     */
    protected File[] getFiles(String[] fileNames) {
        File[] files = new File[fileNames.length];
        for (int i = 0; i < fileNames.length; i++) {
            files[i] = new File(fileNames[i]);
        }
        return files;
    }
    /**
     * Returns the resource either casted to or adapted to an IFolder. 
     * 
     * @param resource resource to cast/adapt
     * @return the resource either casted to or adapted to an IFolder.
     * 	<code>null</code> if the resource does not adapt to IFolder 
     */