Bug 227213 - [regression] Cannot duplicate a file subtree by giving new name in the same folder
Summary: [regression] Cannot duplicate a file subtree by giving new name in the same f...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Rupen Mardirossian CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: contributed, PII
: 228489 (view as bug list)
Depends on: 210682
Blocks:
  Show dependency tree
 
Reported: 2008-04-15 16:00 EDT by David McKnight CLA
Modified: 2011-05-25 07:34 EDT (History)
6 users (show)

See Also:
dmcknigh: review+


Attachments
Copy & Paste to Parent Folder (6.60 KB, patch)
2008-04-23 13:49 EDT, Rupen Mardirossian CLA
no flags Details | Diff
Copy & Paste to Parent Folder (10.08 KB, patch)
2008-04-30 16:45 EDT, Rupen Mardirossian CLA
no flags Details | Diff
patch updated to merge with other changes (6.58 KB, patch)
2008-05-06 08:41 EDT, David McKnight CLA
no flags Details | Diff
Updated Patch (6.59 KB, patch)
2008-05-06 11:43 EDT, Rupen Mardirossian CLA
mober.at+eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David McKnight CLA 2008-04-15 16:00:54 EDT
comments from Ankit from bug 225573:

The following scenario does not work:

1. Copy a folder in RSE
2. Paste it on the PARENT of itself.

This was supported in the IBM RSE and gave a conflict dialog to the user. The
dialog allowed the user to rename the resource being copied. 

A general case of the last comment, if I copy a file/folder into a folder that
already contains a resource by that name, I DO NOT get an option to rename the
resource being pasted. I can only overwrite the existing resource.
Comment 1 Rupen Mardirossian CLA 2008-04-17 14:38:09 EDT
Hey Dave, 

Support to rename on a copy collision has been removed as per enhancement in bug 210682
Comment 2 Martin Oberhuber CLA 2008-04-21 09:10:54 EDT
Changed summary, previous value was:
copy/paste on parent of resource on it's parent doesn't missing rename dialog

It looks like what the client is trying to achieve, is take a whole file tree and duplicate this tree in the same folder by giving it a new name. 

This is a use-case that we should still support, although I'm not sure if our previous solution, having a "rename" option on the "paste conflict resolution" dialog, is the right thing to do.

Right now, when I "Copy" the folder and "Paste" it onto its parent, RSE simply does nothing at all; which definitely does not seem the right thing to do. When I do the same with Windows Explorer, it automatically creates a folder named "Copy of src"; and when I do it again, it creates a folder named "Copy (2) of src".

I could imagine providing the same functionality as Windows Explorer here; or, restoring the ability to select a different name in the special case that a folder or file is tried to copy onto itself.

Thoughts?
Comment 3 Martin Oberhuber CLA 2008-04-21 09:24:31 EDT
Since this is a regression, we should fix it for M7 (feature freeze) with highest priority.
Comment 4 Rupen Mardirossian CLA 2008-04-21 09:34:50 EDT
I think having a duplicate of the source with "Copy of" + name as the source name would be a better solution than bringing back the rename for this one particular case.  
Comment 5 Rupen Mardirossian CLA 2008-04-21 15:09:48 EDT
I have a working solution right now, just wondering on committers thoughts of the naming convention that we should use.

Currently I have 

Copy of file 
Copy of file (2)
Copy of file (3) 

If we go by Windoze, it should be something like this:

Copy of file 
Copy (2) of file 
Copy (2) of file  

Any suggestions/thoughts?

Rupen
Comment 6 Martin Oberhuber CLA 2008-04-22 05:34:07 EDT
I like the Windows style better, but I'm afraid that the solution is problematic anyways because the text should be internationalized / translated, so it is PII and PII has been frozen yesterday.

At any rate you should use a Pattern and Java MessageFormat such that the place of the number can be changed easily:

String pattern = "Copy {0,choice,1<({0,number,integer})} of {1}"; //$NON-NLS-1$
String s = MessageFormat.format(pattern, new Object[] { 
    new Integer(num), filename });

The pattern should eventually go into a Java Properties File (NLS) such that it can be translated into other languages. See the Java MessageFormat Javadoc for the pattern language markup.

Xuan / DaveD, what do you think?
Comment 7 Rupen Mardirossian CLA 2008-04-22 14:43:20 EDT
Thanks for suggesting the usage of MessageFormat Martin.  Seems to have worked in my favor using a pattern String for this defect. 

I have a working solution using MessageFormat.  I will post a patch as soon 
as bug 198728 gets committed as it deals with the same file.

Rupen
Comment 8 Rupen Mardirossian CLA 2008-04-23 11:05:16 EDT
Question? what happens when a folder/file is selected within the parent and outside of the parent then copied to the parent (both already existing but not the same file).

What should happen if the user cancels the overwrite of the resource outside of the parent? should the "Copy of" of the resource inside the parent still be created?

Rupen
Comment 9 Martin Oberhuber CLA 2008-04-23 11:33:29 EDT
Can you rephrase that? I don't understand the question. Perhaps use concrete example like a/b/c copied into a/c etc
Comment 10 Rupen Mardirossian CLA 2008-04-23 11:47:09 EDT
Lets say 

FolderA is the child of FolderB
FolderC is not related to these folders but has the same name as one of the children in FolderB

FolderA and FolderC are copied to FolderB

User gets a dialog saying that FolderC already exists in FolderB would you like to overwrite? 

If the user chooses to cancel, should "Copy of FolderA" still be created? 
Comment 11 Martin Oberhuber CLA 2008-04-23 11:54:28 EDT
Oh, so you're copying multiple sources in a single copy operation. These seems a pretty rare corner case here, especially since you're mixing "same instance" with "different instance" case. Anyways, I think the following approach seems to make sense:

Perform the same operation as if all the sources of your copy operation (FolderA and FolderC in this case) would be the children of some "VirtualRoot" folder and the VirtualRoot folder is copied into FolderB.

In this case, you would show the "Merge" dialog saying:
  FolderA already exists in target
  FolderB already exists in target
Do you want to overwrite existing resources?

In other words, you warn the user about copying FolderA into FolderA in this case even though this is a trivial no-op here. What counts is giving the feedback about what's about to happen. Since user requested a combined multi-op he should see a feedback dialog for his entire multi-op.
Comment 12 Martin Oberhuber CLA 2008-04-23 11:56:04 EDT
But you might want to try out what Windows Explorer does in this case.
Comment 13 Rupen Mardirossian CLA 2008-04-23 13:49:55 EDT
Created attachment 97279 [details]
Copy & Paste to Parent Folder

Here is the patch using MessageFormat, Please review and commit when possible.

Thanks,
Rupen
Comment 14 Martin Oberhuber CLA 2008-04-23 14:48:59 EDT
*** Bug 228489 has been marked as a duplicate of this bug. ***
Comment 15 Ryan CLA 2008-04-25 15:57:48 EDT
When copy and pasting a single file, I much prefer the dialog box option of renaming the file and wish this feature wasn't removed. I often copy a file and know what I want to rename it. I would not want a new file created with a file named something I didn't name and then I would have to go back and name it the file name I want. That's tedious, and in a directory with a lot of files it wouldn't end up in the same area as the previous file. 

So for example, if I have a file myproject1.ser and I want to create a new file myproject2.ser, I can select myproject1.ser, copy, click on the folder and paste, get the pop up, change the file name to what I want and be done with it.
Comment 16 Martin Oberhuber CLA 2008-04-25 16:04:14 EDT
Arguably, provided that the default action for Rename/Overwrite is "Rename", AND the focus on the dialog is the field for the new name, you are right and fewer mouse clicks are required for the "old style".
Comment 17 Xuan Chen CLA 2008-04-29 15:28:49 EDT
We also encountered this problem (copy a file/folder to its parent just did nothing) during our IFS support.  It is kind of annoying, and hope it could be fixed very soon.

We still have until May 8 for NL string changes.
Comment 18 Martin Oberhuber CLA 2008-04-29 16:22:15 EDT
I agree that we need to find consensus on this topic quickly. I added it to our committer meeting agenda for tomorrow,
   http://wiki.eclipse.org/DSDP/TM/Committer_Phone_Meeting_30-Apr-2008

Please prepare for the discussion by making up your mind what you think is the right thing to do.
Comment 19 Rupen Mardirossian CLA 2008-04-30 16:45:27 EDT
Created attachment 98263 [details]
Copy & Paste to Parent Folder

RESID_CONFLICT_COPY_PATTERN is the NL String that was added containing the MessageFormat pattern.  Please review.
Comment 20 Rupen Mardirossian CLA 2008-05-02 09:27:43 EDT
Could someone please review and commit this one for M7.

Thanks,
Rupen
Comment 21 Martin Oberhuber CLA 2008-05-02 10:13:47 EDT
DaveM, you filed this bug, can you review it please?

Rupen: Did you manage to automatically select the renamed ("Copy of...") resources in the SystemView when the operation is complete, as we discussed in http://wiki.eclipse.org/DSDP/TM/Committer_Phone_Meeting_30-Apr-2008 ?

Also note that you can use Bugzilla's "review" flag to ask for a review.
Comment 22 Rupen Mardirossian CLA 2008-05-02 10:31:58 EDT
No, at this point the resources are not selected.  Can I open up a separate enhancement on that please?  There might be complications and I might not have time to look into it for M7.  

Thanks,
Rupen
Comment 23 Martin Oberhuber CLA 2008-05-02 10:51:40 EDT
Sure. Please do open the new enhancement request, and link it to this one via depends/blocks.
Comment 24 David McKnight CLA 2008-05-02 16:50:08 EDT
I don't have time to look at this in any detail now.  I'll try to get to it on monday.
Comment 25 David McKnight CLA 2008-05-06 08:41:44 EDT
Created attachment 98822 [details]
patch updated to merge with other changes

I've had to update the patch since SystemViewRemotefileAdapter changed independently of this one.  The update to the patch was completely manual since the compare tooling fails in this case.  

Rupen, can you check the patch to ensure that I didn't change the logic from what you originally had (i.e. misplacing parenthesis or something).
Comment 26 Rupen Mardirossian CLA 2008-05-06 11:43:10 EDT
Created attachment 98864 [details]
Updated Patch

Hey Dave, 

I merged the code as per conversation.  Please review and commit.

Thanks,
Rupen
Comment 27 David McKnight CLA 2008-05-06 14:45:29 EDT
The patch works well.  I've committed the changes to cvs.