score:23
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.
Make your
Package Explorer
link with editor, you can active this by click the double-arrow icon at top-right corner.Set up a hot-key for
Show View (Package Explorer)
ex : Alt + 1Set 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
score:0
The video demonstrating the technique was prepared for Eclipse in Windows. In Linux you have to change:
- External Tools Configurations - Location: /home/username/path/to/script.sh
- External Tools Configurations - Arguments: ${selected_resource_loc}
- External Tools Configurations - Standard Input and Output - CHECK "Allocate console (necessary for input)"
- Create a script /home/username/path/to/script.sh as follows
echo $1
echo $1 > /home/username/clipboard_tmp.txt
xclip -in -selection clipboard /home/username/clipboard_tmp.txt
xclip -selection clipboard -o
I don't know why, but following command echo $1 | xsel --clipboard
doesn't work in the script.
It was checked in Ubuntu 12.04 LTS and Eclipse IDE for C/C++ Developers (Version: Kepler Service Release 2, Build id: 20140224-0627)
score:0
score:1
- Go to Project Explorer View in Eclipse which is at the left panel.
- Click on link with editor.
- After linking, your opened file will get selected.
- Right-click on the selected file. You will get the option 'Copy Qualified Name' which is just below 'Copy' option.
- Open the directory where your project resides. e.g. if your project is 'abc' and it's in the directory 'project', go to the 'project' directory.
- In the folders address bar, the address will be like this:
D:\project
. - Paste in front of this address like:
D:\project/abc/source/com/connect.java
- Delete the java file name(connect.java) and press
enter
.
You will be in folder 'com'.
score:2
Another option is EasyShell. It has a single entry in the context menu, under which you'll find copying of the path, opening explorer, a dos box and others (configurable).
score:3
Alt+Enter - open properties
Alt+L - go to path location
Shift+End - select path
Ctrl+C - copy
score:4
An alternative to the answer of Rangi Lin, which provides some additional functionality: The StartExplorer plugin for Eclipse. The solution mentioned by Rangi Lin doesn't work in all cases. It doesn't work in my case e.g. in the Team Synchronizing perspective in the Synchronize view. However, the StartExplorer's context menu command "Copy Resource Path To Clipboard", as well as the default keyboard shortcut for it (Ctrl+Alt+C) works also there. The advantage of this plugin is that it additionally allows you to open the file manager at the location of the selected file etc.
score:5
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.
score:12
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'.
score:25
- 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/
Source: stackoverflow.com
Related Query
- How to quickly copy the current editing file name or full file path in Eclipse (Luna)?
- Copy File in eclipse copies file name (String) instead of file to clipboard
- Copy path/file name in Eclipse to clipboard
- Change name and/or path of .classpath file in Eclipse
- Eclipse same name file include path c c++
- How to get selected file name and its package path in eclipse plugin
- Android - copy existing project with a new name in Eclipse
- Eclipse Java launch configuration file path
- "Module name is invalid" when exporting an existing eclipse project to a war file
- Get the absolute path of the currently edited file in Eclipse
- Eclipse 3.8 - Prevent File Name Truncating in Editor Tabs
- Eclipse PDE, Navigator View, TreeSelection - Obtaining the file type and name
- Eclipse CDT Can't Find include file unless full relative path is used
- Eclipse C/C++ (CDT) import files into project - header file not found - include path
- Show the name of the containing folder in the Eclipse tab of a file
- Exclude a folder name from Eclipse file search
- How to determine absolute file path of a Java source file in Eclipse plugin?
- Eclipse - Using File Name Conventions on Refactoring php-Classes
- Error: Path Must Include project and resource name:/<jar file name> in eclipse IDE
- How to remove file path viewer from eclipse editor view
- Eclipse 3.5: How to get file name from Editor?
- Eclipse remove name patterns in File search
- Invalid file name error in Eclipse
- open file with full project path in eclipse
- how to change a file name in Android Eclipse development
- Where to put properties file in eclipse and how to access the path both locally and on server
- How do I get the file path of the open workspace for developing plugins in eclipse
- Eclipse / PyDev - Remove path from editor tabs when two files with same name are opened
- Eclipse CDT - Link individual library with space in file path
- Eclipse CDT - Copy static resource file to bin_dir
More Query from same tag
- Django Project created in Eclipse (PyDev) runs out of command line, not out of Eclipse
- Project level control over use of autopep8
- Easy Android Activity
- Is Google Play Services for Froyo compatible with Android 2.3 and higher?
- JFrame + JOGL only displays content when resized or minimised + maximised
- Quick way to insert interface methods to a class in Visual Studio 2005
- Can't build the cocos2dx sample HelloCpp project
- Can eclipse pydev interpret a file as a python file without a suffix
- java files containing unicode don't compile
- JMH not working in Eclipse (as Maven project) - No benchmarks to run
- Create new project, R.java file not generated
- Eclipse IDE won't start
- Refactoring to subclasses - how do I combine instance methods?
- How to have builders/source-folders of different types in same eclipse project
- script to execute the eclipse PDE Tools > Build site
- can Eclipse Che be used for traditional monolithic application development? Application that does not make use of Docker
- Export Eclipse Project with native library
- ADT plugin for eclipse helios on Win7 64 bit install error
- Unfortunately app has stopped in webview using eclipse
- Eclipse Juno - how to make the views minimize when they lose focus?
- Jasper Studio compile report issue - Unsupported class file major 61
- Running jar file / .class file along with a properties file
- Java Editor in Eclipse is acting like a plain text editor
- Incompatible debugger version - error 2006040705
- Unable to adjust admob ad android
- go to file in eclipse by using location datatype
- What's the gradle equivalent of having another project in your Java build path in Eclipse?
- Eclipse Indigo PDT does not underline syntax errors
- how to manage javascript or front project
- Java eclipse expression window view the full HttpRequest from @RequestBody