Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy path/file name in Eclipse to clipboard

Is there a shortcut to copy the current path/file to the clipboard?

like image 708
user710818 Avatar asked Nov 04 '11 07:11

user710818


People also ask

How do I copy a file path to the clipboard?

Find the file or folder whose path you'd like to copy in File Explorer. Hold down Shift on your keyboard and right-click on it. In the context menu that pops up, select “Copy As Path.”


4 Answers

  • Just select the file tab and hit Ctrl+C to copy file basename into clipboard.
  • Hit Alt+Enter to bring up the file properties with absolute path and copy it manually.
  • Additionally you can use an Eclipse macro plugin that can do the steps in one go: http://sourceforge.net/projects/practicalmacro/files/
like image 110
Peter Szanto Avatar answered Sep 29 '22 01:09

Peter Szanto


There is Copy Qualified Name function in Eclipse, it will copy the full name of the element you select (or element on cursor).

For example :

/MyProject/src/app/Application.java : when you select Application.java in Package Explorer

java.util.HashSet<String> : when you copy while cursor at HashSet<String>

However, it required you to select the element you want.

So, here is what I do.

  1. Make your Package Explorer link with editor, you can active this by click the double-arrow icon at top-right corner.

  2. Set up a hot-key for Show View (Package Explorer) ex : Alt + 1

  3. Set up a hot-key for Copy Qualified Name ex : Alt + Ctrl + Shift + c

Whenever I need these information in current file, I just press the hot-key to call my Package Explorer Since it links with editor and will always select the file in current editor, you can just copy with the hot-key. Then you can use F12 back to your editor, or simply ESC if you use fast view.

Not perfect, but it works :D

like image 33
Rangi Lin Avatar answered Sep 29 '22 01:09

Rangi Lin


There is yet another plugin that supports copying the path along with a number of other related functions:

http://code.google.com/p/pathtools/

Just search Eclipse Marketplace within Eclipse for 'pathtools'.

enter image description here

like image 12
ThomasW Avatar answered Sep 29 '22 03:09

ThomasW


You can do it with a single keystroke by configuring an Eclipse external tool (a much underused tool in my opinion). Takes about a minute to configure the first time you use it but then it's always available. Here's a YouTube video demonstrating the technique.

like image 5
Tod Avatar answered Sep 29 '22 03:09

Tod