Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Need to save before copy-pasting files(Eclipse wants all edit windows saved before pasting but why?)
Need to save before copy-pasting files [message #1807181] Fri, 24 May 2019 08:11 Go to next message
Michael Berg is currently offline Michael BergFriend
Messages: 6
Registered: April 2019
Junior Member
There's this thing which has been a constant source of irritation for me when using eclipse. Perhaps someone here can shed some light on why this is happening.

Working with Java in the Package Explorer, I sometimes need to copy-paste a java file from the source tree to create a new class that I need to reference in the file I am currently editing.

I can copy the source file with ctrl-c but as soon as I try to paste it with ctrl-v, eclipse comes up and demands that I save all my current edit windows first. I can have perhaps 4-5 edit windows open that are all in this state of half-way-done and I'm just not ready to save all that just yet. But eclipse absolutely insists that I do that, because this is somehow super critical to creating a new file As if the new file will somehow be wrong if I don't save everything I have in my edit windows. Like, wtf?

The strange thing is that I can simply switch to the Navigator view and paste the file in there - no problemo.

As you can tell I'm not super impressed with this behavior. I'll happily save my work if I understand why it's important, but right now it just feels like eclipse is toying with me for no good reason.

-Michael
Re: Need to save before copy-pasting files [message #1807194 is a reply to message #1807181] Fri, 24 May 2019 12:40 Go to previous messageGo to next message
Eclipse UserFriend
You could open a bug report against JDT-UI. But better would be to provide a patch :-) I'm not familiar with this code, but I *think* a starting point might be this PasteAction class and its associated pasters (maybe its sub-type JavaElementAndResourcePaster?). I did some other poking about and came across a IReorgPolicy which has a `getSaveMode()` which defaults to a SAVE_ALL. I suspect somehow either making that pluggable, or providing a specialized IReorgPolicy for pasting files that uses SAVE_NONE, might do the trick.

Brian.
Re: Need to save before copy-pasting files [message #1807238 is a reply to message #1807194] Sat, 25 May 2019 13:10 Go to previous messageGo to next message
Michael Berg is currently offline Michael BergFriend
Messages: 6
Registered: April 2019
Junior Member
"Your ideas are intriguing to me and I wish to subscribe to your newsletter" as a lovable cartoon character once said.

But seriously - I understand some of the words you say and they sound really smart. I hope that more skillful developers will pick up on this and provide a patch, because this is one of those things that just make me want to switch to another editor which is already packed with intelligent IDEAs.

- Mike
Re: Need to save before copy-pasting files [message #1807253 is a reply to message #1807238] Sun, 26 May 2019 13:03 Go to previous messageGo to next message
Eclipse UserFriend
<strike>Tbh the Package Explorer has been deprecated for years and and the Project Explorer is its successor.</strike> The Package Explorer is JDT-specific to boot. You should use the Project Explorer instead.

Edited: Package Explorer isn't deprecated.

[Updated on: Mon, 27 May 2019 15:53] by Moderator

Report message to a moderator

Re: Need to save before copy-pasting files [message #1807294 is a reply to message #1807253] Mon, 27 May 2019 15:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
Is that really true? It's the default view in the Java perspective isn't it?

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Need to save before copy-pasting files [message #1807295 is a reply to message #1807294] Mon, 27 May 2019 15:52 Go to previous messageGo to next message
Eclipse UserFriend
I'm mistaken: I thought it was agreed to be deprecated and replaced.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=427897
Re: Need to save before copy-pasting files [message #1807337 is a reply to message #1807294] Tue, 28 May 2019 10:36 Go to previous messageGo to next message
Michael Berg is currently offline Michael BergFriend
Messages: 6
Registered: April 2019
Junior Member
No Message Body
Re: Need to save before copy-pasting files [message #1807339 is a reply to message #1807337] Tue, 28 May 2019 10:37 Go to previous messageGo to next message
Michael Berg is currently offline Michael BergFriend
Messages: 6
Registered: April 2019
Junior Member
The package explorer and project explorer behave the same way. You are asked to save all files before you are allowed to paste new files in.
Re: Need to save before copy-pasting files [message #1807352 is a reply to message #1807339] Tue, 28 May 2019 11:48 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
I'm sure there's a reasonable reason for this behavior. JDT supports all kinds of intelligence while pasting so likely there is some reasoning based on that. But you could ask on the JDT forum if someone there can explain the logic behind this decision.

https://www.eclipse.org/forums/index.php/f/13/


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Eclipse Group Licences Concern
Next Topic:Would like to fix bug in Compare editor
Goto Forum:
  


Current Time: Sat Nov 09 01:26:50 GMT 2024

Powered by FUDForum. Page generated in 0.04768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top