Bug 501889 - Renaming multiple files cannot be done keyboard-only (selection lost after Rename Resource)
Summary: Renaming multiple files cannot be done keyboard-only (selection lost after Re...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-21 04:45 EDT by Andreas Sewe CLA
Modified: 2020-06-04 11:17 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot (1.77 KB, image/png)
2016-09-22 04:23 EDT, Noopur Gupta CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2016-09-21 04:45:46 EDT
First of all: I know that there is some discussion underway how to do things actions like Rename "inline" (i.e., without opening a dialog).

But maybe there's an easy fix in the meantime for the following very annoying behavior:

When renaming a large number of files (e.g., adding a common prefix), you proceed as follows:

- Select a file in the Package Explorer
- Use the Rename keyboard shortcut
- Perform the necessary change in the Rename Resource dialog
- Hit enter
- As this looses my previous selection in the Package Explorer, you have to use the *mouse* to select the next file.

Would would be great if the selection were not lost. Then you could simply hit Arrow Down and proceed with renaming using the keyboard only. AFAICT, this is not possible at the moment.
Comment 1 Lars Vogel CLA 2016-09-21 05:08:52 EDT
Package Explorer is provided by JDT. If you see the same for Project Explorer, please open a new bug.

+1 for this request, super annoying. Same happens if I do a Text search, it looses its selection.
Comment 2 Noopur Gupta CLA 2016-09-22 01:30:25 EDT
I do not see this issue with 4.7 M2 build on Windows 7. After rename, you can use the arrow keys to move to the next/previous file in Package Explorer.

If it reproducible on Mac then it could be an issue with SWT.
Comment 3 Till Brychcy CLA 2016-09-22 03:27:32 EDT
(In reply to Noopur Gupta from comment #2)
> I do not see this issue with 4.7 M2 build on Windows 7. After rename, you
> can use the arrow keys to move to the next/previous file in Package Explorer.
> 
> If it reproducible on Mac then it could be an issue with SWT.

On the Mac (4.7 M2): 
- Renaming .java in the package explorer works
- Renaming non-java (.txt or.xml) in the package explorer loses focus, like described in comment#0
Comment 4 Andreas Sewe CLA 2016-09-22 03:36:09 EDT
(In reply to Till Brychcy from comment #3)
> On the Mac (4.7 M2): 
> - Renaming .java in the package explorer works
> - Renaming non-java (.txt or.xml) in the package explorer loses focus, like
> described in comment#0

Wow. That was quick.

You are right. I just verified this myself with 4.7 M2 under OS X myself. The Rename Compilation Unit dialog (.java) keeps the selection, but the Rename Resource dialog (.txt) looses it.

Did some further experiments:

- Rename Compilation Unit: keeps selection
- Rename Package: keeps selection
- Rename Source Folder: keeps selection
- Rename Java Project: keeps selection
- Rename Resource: looses selection
- Rename Folder: looses selection
- Rename Project: looses selection

Interestingly, all these dialogs are instances of org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.
Comment 5 Noopur Gupta CLA 2016-09-22 04:04:32 EDT
Did you try using up/down arrow keys after rename? On Windows, the selection on Java elements is shown clearly but the selection on resources is shown with dotted lines. It could be that the selection is not clearly visible on Mac for resources.
Comment 6 Andreas Sewe CLA 2016-09-22 04:13:23 EDT
(In reply to Noopur Gupta from comment #5)
> Did you try using up/down arrow keys after rename? On Windows, the selection
> on Java elements is shown clearly but the selection on resources is shown
> with dotted lines. It could be that the selection is not clearly visible on
> Mac for resources.

When I hit the down arrow key after closing the Rename Resource dialog, a clearly visible selection shows up -- on the *first* element of the Package Explorer. (If I hit the up arrow key, it shows up on the *last* element.)

Thus, it clearly forgot the previous selection, which was an element somewhere in the middle.
Comment 7 Noopur Gupta CLA 2016-09-22 04:23:39 EDT
Created attachment 264332 [details]
Screenshot

(In reply to Andreas Sewe from comment #6)
> (In reply to Noopur Gupta from comment #5)
> > Did you try using up/down arrow keys after rename? On Windows, the selection
> > on Java elements is shown clearly but the selection on resources is shown
> > with dotted lines. It could be that the selection is not clearly visible on
> > Mac for resources.
> 
> When I hit the down arrow key after closing the Rename Resource dialog, a
> clearly visible selection shows up -- on the *first* element of the Package
> Explorer. (If I hit the up arrow key, it shows up on the *last* element.)
> 
> Thus, it clearly forgot the previous selection, which was an element
> somewhere in the middle.

On Windows, this issue does not happen and the previous selection is remembered even for resources (shown with dotted lines - see screenshot).

Looks like a Mac related issue. Moving to SWT.
Comment 8 Till Brychcy CLA 2018-07-31 15:40:52 EDT
For the case of renaming .java files it works because the renamed file is selected by the selectReveal-call in org.eclipse.jdt.internal.ui.refactoring.reorg.RenameSelectionState.restore(Object)

To me it looks like on Windows, the renamed (non-java) file is not selected, but just focused after renaming.