Bug 507579 - Copy file should open the file
Summary: Copy file should open the file
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-11-16 02:20 EST by Lars Vogel CLA
Modified: 2018-04-16 10:03 EDT (History)
7 users (show)

See Also:


Attachments
Screenshot (29.75 KB, image/png)
2017-04-23 16:18 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2016-11-16 02:20:48 EST
Happens frequently to me:

1.) Copy and existing file
2.) Start editing in the open editor
3.) Realize that the "old" file is still open -> curse and until the changes and open the copied file.

If the user copies a file, it is very likely that he wants to work on the copy. I suggest we open the copied file in the editor area and give it focus.
Comment 1 Andrey Loskutov CLA 2016-11-16 02:34:30 EST
The copied file can be huge or the copy has nothing to do with editing itself. If we want to implement something like this, we should ask user after copy "Do you want to open the copied file?"
Comment 2 Mickael Istria CLA 2016-11-16 03:09:09 EST
I agree with Andrey that this shouldn't happen automatically.
Comment 3 Lars Vogel CLA 2016-11-17 00:51:53 EST
For reference, if I copy a file in IntelliJ, it gets opened automatically and the editor gets focus.
Comment 4 Lars Vogel CLA 2017-04-23 16:18:29 EDT
Created attachment 267927 [details]
Screenshot

(In reply to Lars Vogel from comment #3)
> For reference, if I copy a file in IntelliJ, it gets opened automatically
> and the editor gets focus.

Actually IntelliJ has a flag for this on its copy dialog. "Open copy in editor". See screenshot.
Comment 5 Lars Vogel CLA 2017-07-19 02:30:45 EDT
I think this needs to be done in the JDT UI repo as the refactoring tools are located here.

Adding Noopur. @Noopur, could you give advice how this could fit into the refactoring infrastructure.
Comment 6 Noopur Gupta CLA 2017-07-20 07:40:44 EDT
This should be applicable to copy/paste of a single file. And it should be consistent in Platform and JDT. We can probably add a preference for that.

See org.eclipse.ui.actions.CopyFilesAndFoldersOperation for Platform and 
org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory.CopyFilesFoldersAndCusPolicy for JDT.