Bug 100156 [IDE] RenameResourceAction should use IAdaptable for IResource lookuop
Consider the following setup: there is a tree viewer that contains TreeElementWrapper instances. TreeElementWrapper class is an IAdaptable and may sometimes adapt to IResource instance. When RenameResourceAction receives selectionChanged() it enables itself (since wrapper adapts to resource) but in runWithInlineEditor() method it queries raw selection instead of adapted resources list - thus CCE. java.lang.ClassCastException: com.xcom.TreeElementWrapper at org.eclipse.ui.actions.RenameResourceAction.runWithInlineEditor(RenameResourceAction.java:462) at org.eclipse.ui.actions.RenameResourceAction.run(RenameResourceAction.java:454) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167) at com.xcom.CompositeAction.runWithEvent(CompositeAction.java:26) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108) 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:452) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:722) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:766) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:543) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:486) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:110)
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RenameResourceAction.java
private static String RESOURCE_EXISTS_MESSAGE = IDEWorkbenchMessages.RenameResourceAction_overwriteQuestion;
    private static String RENAMING_MESSAGE = IDEWorkbenchMessages.RenameResourceAction_progressMessage;
    /**
     * Creates a new action. Using this constructor directly will rename using a
     * dialog rather than the inline editor of a ResourceNavigator.
     *
     * @param shell the shell for any dialogs
     */
    public RenameResourceAction(Shell shell) {
        super(shell, IDEWorkbenchMessages.RenameResourceAction_text);
        setToolTipText(IDEWorkbenchMessages.RenameResourceAction_toolTip);
        setId(ID);
        PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
				IIDEHelpContextIds.RENAME_RESOURCE_ACTION);
    }
    /**
     * Creates a new action.
     *
     * @param shell the shell for any dialogs
     * @param tree the tree
     */
    public RenameResourceAction(Shell shell, Tree tree) {
        this(shell);
        this.navigatorTree = tree;
        this.treeEditor = new TreeEditor(tree);
    }
    /**
     * Check if the user wishes to overwrite the supplied resource
     * @returns true if there is no collision or delete was successful
     * @param shell the shell to create the dialog in