Bug 497121 - Not possible to cut and paste in the project explorer
Summary: Not possible to cut and paste in the project explorer
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-06-30 15:44 EDT by Lars Vogel CLA
Modified: 2020-08-03 11:12 EDT (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 2016-06-30 15:44:31 EDT
It should be possible to use the cut operation on a file in the project explorer.
Comment 1 Patrik Suzzi CLA 2016-07-01 11:56:05 EDT
This bug seems complicated. I put the results of a quick analysis. Hope this helps: 

The "Cut" action is not present nor Project Explorer, neither in Package Explorer, at least in Eclipse 4.6, 4.5.2, and 3.8.

To model the Cut action we will need to combine a Copy + Delete(callback), where: 
- "Cut" is equivalent to copy until we complete the paste operation successfully.
- "Paste" should be seen as an atomic operation, integrating the O.S.-Paste with a callback to Eclipse-Delete. 

(1) One of the challenges is we have to get notified by the O.S. when the user "paste" the content, and if the "OS-paste" complete successfully, we have to return the control to eclipse, to trigger the "Atomic" delete of the resource on Navigator. 

- Honestly, I don't know if this is feasible. At line 134 of CopyAction (org.eclipse.ui.internal.navigator.resources.actions), we can read the clipboard does not support callbacks. Any suggestion here would be useful

(2) Another challenge is related to the nature of the Copy command, which is implemented by many different commands, depending on the nature of the project. 
E.g., if you copy a file from a General Project, you execute org.eclipse.ui.internal.navigator.resources.actions.CopyAction . 
Instead, if you copy from a Java Project, you execute org.eclipse.jdt.internal.ui.refactoring.reorg.CopyToClipboardAction 
However, this second point is a minor obstacle w.r.t. (1). 


Thread calls suspended when copying from a General Project

CopyAction.run() line: 103	
CopyAction(BaseSelectionListenerAction).runWithEvent(Event) line: 167	
TextActionHandler$CopyActionHandler.runWithEvent(Event) line: 248	
ActionHandler.execute(ExecutionEvent) line: 118	
E4HandlerProxy.execute(IEclipseContext, Map, Event, IEvaluationContext) line: 90	

Thread calls suspended on copying from a Java Project

CopyToClipboardAction.run(IStructuredSelection) line: 109	
CopyToClipboardAction(SelectionDispatchAction).dispatchRun(ISelection) line: 271	
CopyToClipboardAction(SelectionDispatchAction).run() line: 249	
CopyToClipboardAction(Action).runWithEvent(Event) line: 473	
ActionHandler.execute(ExecutionEvent) line: 118	
E4HandlerProxy.execute(IEclipseContext, Map, Event, IEvaluationContext) line: 90
Comment 2 Mickael Istria CLA 2016-07-01 13:23:59 EDT
There's a move command that we could reuse. A possibility could be to configure the selected resources on Cut, and to invoke Move using the resources that were cut as source and the selection as target
Comment 3 Lars Vogel CLA 2016-09-21 07:49:40 EDT
Putting it on the radar for 4.7, as this is a big usability issue.
Comment 4 Andrew Obuchowicz CLA 2020-08-03 10:56:28 EDT
I think using a move resources command could do the trick as mentioned by Mickael. Would this be an OK approach to use?
Comment 5 Lars Vogel CLA 2020-08-03 11:12:44 EDT
(In reply to Andrew Obuchowicz from comment #4)
> I think using a move resources command could do the trick as mentioned by
> Mickael. Would this be an OK approach to use?

+1