Bug 481242 - Open editor for copied file
Summary: Open editor for copied file
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted, usability
Depends on:
Blocks: 577364
  Show dependency tree
 
Reported: 2015-11-02 09:15 EST by Lars Vogel CLA
Modified: 2021-11-19 07:15 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2015-11-02 09:15:00 EST
On a regular basis I make the error to edit the wrong file after copying a file.

Here is my process:

1.) Mark a file
2.) Copy it
3.) Start typing in the current editor -> wrong 

I suggest we open the copied file in a new editor and give focus to it, after the copy operation. We should only do this if one file is copied, we do not want to open lots of editors if the user copies a full folder structure or multiple files.
Comment 1 Gautier de SAINT MARTIN LACAZE CLA 2015-11-02 10:23:06 EST
I agree, it's one of my common mistake with Eclipse. And for information it's also a common mistake for my co-workers.
Comment 2 Lars Vogel CLA 2016-04-25 15:16:46 EDT
Mass move to 4.7.
Comment 3 Dani Megert CLA 2018-05-24 12:55:36 EDT
Removing target milestone for all bugs that are not major or above.
Comment 4 Dani Megert CLA 2018-05-25 04:06:21 EDT
> Removing target milestone for all bugs that are not major or above.

Of course I meant "major or below".

Sorry for the noise!
Comment 5 Lars Vogel CLA 2018-05-25 04:32:11 EDT
Big usability issue (for me, I almost always end up editing the wrong file).
Comment 6 Till Brychcy CLA 2018-05-25 04:34:49 EDT
(In reply to Lars Vogel from comment #5)
> Big usability issue (for me, I almost always end up editing the wrong file).

+1
Comment 7 Dani Megert CLA 2018-05-25 04:48:09 EDT
(In reply to Lars Vogel from comment #5)
> Big usability issue (for me, I almost always end up editing the wrong file).

I agree, but it seems not to be as bad that someone provides a fix. It's been moved to the next release for 3 times now.
Comment 8 Lars Vogel CLA 2018-09-21 03:40:53 EDT
Jonas, please have a look.
Comment 9 Jonas Hungershausen CLA 2019-09-03 10:33:37 EDT
I found several issues with this:

- There are different actions executed in the Package and Project Explorer respectively. This makes implementing it harder, as it would need to be maintained in two different projects (JDT, platform.ui).

- For the Project Explorer there doesn't seem to be a way to get a hold of the copied resources (only the resource that _was_ copied). 

If we could solve the former problem this functionality could at least be implemented in the Project explorer.
Comment 10 Prashant Bhuruk CLA 2021-01-29 00:02:34 EST
Hello everyone. 

Mickael had suggested on twitter “What about renaming "OK" to "Copy" and adding a "Copy and Open" button?”. I like this idea. 

@Jonas said: 
- For the Project Explorer there doesn't seem to be a way to get a hold of the copied resources (only the resource that _was_ copied). 

I am suggesting this without knowing any implementation details and having not see any code yet. Can we assume the file that has the most recent created date to be the file that_was_copied? Not sure what is the performance implications of determining the latest created file especially if the folder has large number of files. 

—-

I would like to contribute towards this feature. This is my first involvement in open source. I signed the contributor agreement to get started. What all resources I need to go through to get up to speed on the tribal knowledge? 

I have signed up for eclipse-dev mailing list. https://git.eclipse.org/c/ has a lot of repositories. Is there a getting started guide somewhere? Is there any chat channel where I can ask such questions? 

Thank you,
Prashant Bhuruk
https://coderprabhu.com
Comment 11 Lars Vogel CLA 2021-01-29 02:43:13 EST
(In reply to Prashant Bhuruk from comment #10)

> I have signed up for eclipse-dev mailing list. https://git.eclipse.org/c/
> has a lot of repositories. Is there a getting started guide somewhere? 

Hi Prashant,

For the setup I suggest https://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html#exercise-setup-user-account
Comment 12 Prashant Bhuruk CLA 2021-02-02 04:10:36 EST
Thanks Lars. I am going through the guide and was able to push a small fix in readme to get started. 

https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/175606

Will the fix for this issue be in same repository? I will explore the repository to understand it better but are there any particular java files I should be looking at for this fix?
Comment 13 Prashant Bhuruk CLA 2021-02-26 03:16:55 EST
When file is copied, we will let user choose whether copied file is to be opened or not. We also should give option to user to save the selected choice. This preference will be particularly useful in cases when there is no file name conflict and we don’t have way to ask user for choice. 

Part 1: Copy single file name conflict:
    1. A dialogue box is presented where user can choose new file name. 
    2. Today: 
        1. Title: Name Conflict. 
        2. Description: Enter a new name for ‘NameOfFileBeingCopied’ 
        3. Dialogue box shows buttons: Ok and Cancel. 
        4. Ok button is selected by default 
    3. Proposed dialogue box: 
        1. No change to Cancel button, Title and Description  
        2. Rename Ok to Copy 
        3. Add Copy and Open button 
        4. Copy button will be selected by default 
        5. Show checkbox to remember choice of Copy or Copy and Open 
            1. Title: Remember current choice. You can change this later at Preferences -> .. -> .. 
            2. Saves the choice in preference variable “open on copy preference”. More in Part 6 below.
            3. Decision A1: Title: Remember current choice. You can change this later at… 
                1. This can be implemented using a boolean preference 
                2. In this case checkbox will always be shown, letting user change it during all copy operations in future 
            4. Decision A2: Title: Remember current choice and don’t ask again. You can change this later at.. 
                1. This results in three valued string/Enum. Default_Copy, User_Selected_Copy, User_Selected_Open_On_Copy
                2. This case lets us hide the checkbox if the preference contains user selected values 
        6. Default button selection will be based on “open on copy preference”

Part 2: Copying multiple files in same directory when some have name conflict 
    1. Today:
        1. Dialogue box is shown for each conflicting file similar to Part 1: Copy single file name conflict
    2. Proposed:
        1. Dialogue box changes as outlined in Part 1. 
        2. Default button selection based on “open on copy preference” 
        3. For each conflicting file, user will be making choice whether to open or not 
        4. For non conflicting files, open files based on “open on copy preference” and “threshold to open on copy preference”

Part 3: Copying multiple files in different directory when some have name conflict 
    1. Today:
        1. Dialogue box is shown where user can choose to overwrite files at target folder. No option to rename 
        2. Title: Confirm overwriting 
        3. Description ‘NameOfFileBeingCopied’ exists in the selected destination. Do you want to overwrite? 
        4. Shows buttons: Yes to All, No, No to All, Cancel, Yes 
    2. Proposed: 
        1. No change to the dialogue box
        2. Open all copied files based on “open on copy preference” and “threshold to open on copy preference” 

Part 4: Copying single or multiple files with no name conflict
    1. Today:
        1. Files are copied with no need of dialogue box
    2. Proposed: 
        1. Open files based on “open on copy preference” and “threshold to open on copy preference” 

Part 6: Editing preferences 
    1. Preference variables will be editable at 
        1. File-> Preferences -> General (??)
    2. Open on copy preference
        1. Title: “Always open editor for copied file”
        2. Check box 
        3. Default: Not selected 
        4. Based on decision A1 or A2, it will be boolean or three values field Default_Copy, User_Selected_Copy, User_Selected_Open_On_Copy
    3. Threshold to open on copy preference
        1. Editable when “open on copy preference” is selected 
        2. Title: “Only open files if count is less than”
        3. Number entry box 
        4. Default: 5

Please let me know your opinion or comments. I am specifically looking for comments on following
1. Do we want to give user an ability to save open on copy choice as preference
2. Decision A1/A2: Will the choice be a “do not ask again’ kind of choice 
3. What is the right path to show the preference?  
4. Do we want to consider scenarios for multiple file copies 
5. Do we want to keep the preference for “threshold to open on copy”
Comment 14 Prashant Bhuruk CLA 2021-02-26 03:23:03 EST
Apologies for not being mindful about the character limit per row. I wish I could edit
the comment. Can admins delete it? I will repost with better formatting if deleted.
Comment 15 Andrey Loskutov CLA 2021-02-26 07:51:20 EST
About opening after copy for *multiple* files: clear *no*. In worst case that can kill UI by opening thousands of files.

Also automatically open a single file can be undesirable after copy, if the file is not a trivial small java code snippet but machine generated "something", or a big log file, or a tar.gz or whatever else. We have customer projects containing gigabytes of data, no one will ever want to have that blobs be opened just because they were copied around. So I vote against "automatic" thing without user interaction.
Comment 16 Prashant Bhuruk CLA 2021-05-12 03:29:38 EDT
Hi Andrey. Thanks for your inputs. It makes sense to not open files by default. 
Updating to remove automatic opening and preference related part 6. 

As the preference is removed, we won't open multiple files by default using it. 
Updated Part 3 and 4 below. 

When we copy multiple files from a directory to itself, the dialogue box presented 
is same as when we copy single file. It's shown once for each file. If we change 
code for single file case, it will also apply to multiple file case. Should we 
consider how may files are being copied and decide to show the 'Copy and Open' 
button and choice of label for Copy/Ok button accordingly? This is 
'Proposed Choice B' in Part 2. Could you please suggest between choice A and B?

Part 1: Copy single file from same directory with name conflict
    1. A dialogue box is presented where user can choose new file name. 
    2. Today: 
        1. Title: Name Conflict. 
        2. Description: Enter a new name for ‘NameOfFileBeingCopied’ 
        3. Dialogue box shows buttons: Ok and Cancel. 
        4. Ok button is selected by default 
    3. Proposed: 
        1. No change to Cancel button, Title and Description  
        2. Rename Ok to Copy 
        3. Add 'Copy and Open' button 
        4. Copy button will be selected by default 
        5. User will choose whether to copy or copy and open

Part 2: Copy multiple files in same directory causing name conflict 
    1. Today:
        1. Dialogue box is shown for each conflicting file same as 'Today' section
           of 'Part 1'.
    2. Proposed choice A:
        1. Dialogue box changes as outlined in 'Proposed' section of 'Part 1'.
        2. For each file, user will choose whether to copy or copy and open. 
    3. Proposed choice B:
        1. No change to Cancel button, Title and Description  
        2. Show 'Ok' button
        3. Don't show 'Copy and Open' button 
        4. Ok button will be selected by default.

Part 3: Copy multiple files in different directory with name conflict
    1. Today:
        1. Dialogue box is shown where user can choose to overwrite files. 
        2. No option to rename 
        2. Title: Confirm overwriting 
        3. Description ‘NameOfFileBeingCopied’ exists in the selected destination.
           Do you want to overwrite? 
        4. Shows buttons: Yes to All, No, No to All, Cancel, Yes 
    2. Proposed: 
        1. No change to the dialogue box
        2. No change to behavior of any button 

Part 4: Copying single or multiple files with no name conflict
    1. Today:
        1. Files are copied with no need of dialogue box
    2. Proposed: 
        1. No change 

Part 5: Copy single file in different directory with name conflict
    1. Today:
        1. Same as Part 3.
    2. Proposed: 
        1. Same as Part 3.

Part 6: Editing preferences 
    1. Removed since we dont want to open files by default.