I envy Eclipse users - I want this feature, too!

For the first time ever I found one of those little time-saving, nice and code centric features that make Idea stand out ... in Eclipse instead:
http://www.jetbrains.net/jira/browse/IDEA-11075
Copy code from a forum message and paste to the project tree to have Eclipse create packages and files as needed and paste the text in the individual files.

Pardon me lobbying for it here, but if you feel it's useful, please go ahead and vote for the Jira issue to have it in Idea.

7 comments
Comment actions Permalink

It's not copying code from a forum message that I'd love, it's copying code from another IDEA project (ideally with drag-and-drop).

--Dave Griffith

0
Comment actions Permalink

Usually I find eclipse to be lacking and awkward, but this one is a nice feature, for a change. BTW,it would be nice to have this working for diffs as well.

0
Comment actions Permalink

+1

Also the ability to drag-and-drop (as well as copy&paste) files between the
project view and the native desktop (Windows Explorer) would be great.

Sascha

0
Comment actions Permalink

Yes! especially if I can drag a package from one project to another and have
idea fix package name in all files for me

"Dave Griffith" <dave.griffith@cnn.com> wrote in message
news:22365243.1169132091652.JavaMail.itn@is.intellij.net...

It's not copying code from a forum message that I'd love, it's copying
code from another IDEA project (ideally with drag-and-drop).

>

--Dave Griffith



0
Comment actions Permalink

That's a cool feature for getting code into your project quick.
Although I would like for it to automatically change the package
for me.

For instance, if I find some code with package "org.acme.foo",
I would like to copy and paste the code into my package "com.abc.util".

Steps.
1. Copy java code from firefox.
2. Switch to IDEA and click on "com.abc.util" package in Project Tree.
3. Paste.

0
Comment actions Permalink

That's a cool feature for getting code into your project quick.
Although I would like for it to automatically change the package
for me.


I think this should be done more IDEAlly:
If the code is dropped onto an existing package, the class should
be created right there (with the package declaration adjusted); if it is
dropped in a source root folder, a new package (as specified in the
copied code) should be created if necessary, and the class should
be created there.

Regards,
Jens

0
Comment actions Permalink

It's true that often I will want to change the packages.
However I think there should be no automagic adjustments here, because it would impossible for Idea to get it right in each and every case and it is very easy to adjust the packages after the fact (esp. with drag'n'drop refactoring in Selena):

What should Idea do if there are multiple classes with different packages in the clipboard?
Move them all to the same package? Most probably I want to keep them in different packages
Pop up a dialog that let's me configure a mapping from old to new package? Maybe an acceptable solution, but feels too heavyweight, esp. because it's just as easy to refactor afterwards.
Or maybe use the longest common package prefix of all classes in the clipboard (e.g. org.acme for packages org.acme.foo and org.acme.bar) and replace it with the selected package (so creating subpackages foo and bar of the selected package)? Maybe, but that's way too surprising.

Better to have a 90% solution that is 100% correct, than a 110% solution that is right in 80% of the cases and forces me to clean up after my IDE messed up.

0

Please sign in to leave a comment.