Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357667

Summary: RSE view cannot "paste" onto same element that was "copied" from
Product: [Tools] Target Management Reporter: Martin Oberhuber <mober.at+eclipse>
Component: RSEAssignee: Martin Oberhuber <mober.at+eclipse>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: uwe.st
Version: 3.3   
Target Milestone: 3.4 M5   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 370203, 370204, 370205    
Attachments:
Description Flags
patch v1 none

Description Martin Oberhuber CLA 2011-09-14 13:58:39 EDT
Build ID: RSE 3.3 (Indigo)
CQ:WIND00298424

It is a common metaphor to duplicate (clone) an item by doing a Copy-Paste sequence. For instance, in Windows Explorer, one can select a file, the Ctrl-C Ctrl-V will duplicate the file with a new name.

We'd like to implement the same in our product for connections, and other items but it's not possible since RSE disallows "paste" when the item to paste on is the same as it was copied from:

See org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable#transferRSEResources, line 165. RSE is not executing the "paste" if source and target object are the same.

There is some justification in this since it's easy to accidentlly drag-and-drop an item onto itself where a single click was intended... yet it feels incorrect to make that decision inside RSE. Clients (subsystem implementers) should have the choice of implementing their own adapter for handling drag-and-drop or copy-and-paste, even if it happens to paste onto the item that was copied from.
Comment 1 Martin Oberhuber CLA 2011-09-30 08:04:23 EDT
Created attachment 204372 [details]
patch v1

Attached patch allows "Copy-onto-myself" in the RSE System View.

I tested this with all subsystems that I could get hold of on a Win7 host with Eclipse 4.2m2:
  - SSH files, shells, terminals, processes; 
  - dstore files, shells, processes;
  - ftp files; 
  - Local files, shells; 
  - daytime; 
  - test; 
  - team; 
  - TCF ).
I couldn't test telnet due to NPE errors.

The only change of behavior I could see was when dragging the "My Home" filter of an FTP Files Subsystem onto itself. Without the change, this was ignored. With the change, the following message was generated in the error log and an error dialog was shown ("RSEG1270E: Invalid transfer operation"):

RSEG1270E: SUB#1:szg-mober-l3.schnibble.wrs.com-ftp.interface org.eclipse.rse.services.files.IFileService.szg-mober-l3.szg-mober-l3:ftp.files.My Home

On a TCF connection I got this when trying to drag onto itself, but I don't think it's related to this change... will need to retest at some point:

!ENTRY org.eclipse.core.jobs 4 2 2011-09-30 13:47:05.661
!MESSAGE An internal error occurred during: "Transfer Operation".
!STACK 0
java.lang.Error: Remote peer does not support org.eclipse.tm.tcf.services.IFileSystem service
	at org.eclipse.tm.internal.tcf.rse.TCFConnectorService.getService(TCFConnectorService.java:295)
	at org.eclipse.tm.internal.tcf.rse.TCFConnectorService.getFileSystemService(TCFConnectorService.java:304)
	at org.eclipse.tm.internal.tcf.rse.files.TCFFileService$12.run(TCFFileService.java:763)
	at org.eclipse.tm.tcf.util.TCFTask$1.run(TCFTask.java:55)
	at org.eclipse.tm.tcf.EventQueue.run(EventQueue.java:99)
	at java.lang.Thread.run(Thread.java:619)
Comment 2 Martin Oberhuber CLA 2012-01-31 07:12:41 EST
Patch committed.
Will create defects against FTP and TCF for the "drag-onto-myself-issues".
Comment 3 Martin Oberhuber CLA 2012-01-31 07:22:38 EST
Filed following bugs for follow-up:

bug 370203 - FTP message logged
bug 370204 - TCF message logged 
bug 370205 - Telnet NPE

Released into 3.4M5.