Thursday, September 21, 2006

How to open The Windows Explorer With A File Selected In Eclipse

Overview :

This is a handy little trick that can be used within Eclipse, basically (in a nut shell) it allows you to open windows explorer to the location of any select file from eclipse....

Setup:
Create an external tool with location ${env_var:SystemRoot}\explorer.exe and arguments /select,${resource_loc} . Any selected file or directory can now be shown in the windows explorer.

How do I do that?

From eclipse : Run -> External Tools.
Within here add the following:
  1. Create a new Program, This is done by right clicking on program on the tree and clicking "new"
  2. Name it shell
  3. Set the location to ${env_var:SystemRoot}\explorer.exe
  4. Set the arguments to /select,${resource_loc}
  5. Run it:

How do I run it?

When you have any file selected in Package Explorer view or Navigator view and run your new Shell program, the folder containing that file will automatically be opened in windows explorer. Note: If you are in the editor it will show the file you are currently editing in the explorer.... Note: If you don't run immediately, you should either add it to the favorites in the "External Tools" Menu, or run it once, then it will be added to the favorites.