File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes eclipse3.x short cut keys. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "eclipse3.x short cut keys." Watch "eclipse3.x short cut keys." New topic

eclipse3.x short cut keys.

Krish Pinnamaneni

Joined: Mar 16, 2005
Posts: 22
I would like to learn eclipse3.x short cut keys.Please help me where to find this information.
In Advance,
Krish Pinnamaneni.
Animesh Shrivastava
Ranch Hand

Joined: Jul 19, 2004
Posts: 298
Here are some Eclipse short-cuts you can use to reduce time taken while coding. I dont know for which eclipse version

For creating new files:

Go to Window � Preferences �
Click on the �+� sign against Java
Select Code Generation
Select the Code and Comments tab
Select New Java Files and click on the Edit button
Copy and paste the file beginning comments at the top as shown below:

* Class Name :

* Author : Your name here

* Description :

* External methods used :


* Modification Log :

* Ver No Date Author Modification

* 1.0 Your name here Draft Copy


Keep the $(package_declaration) and $(type_declaration) comments as they are. This will ensure that every time you create a new Java file, the comments at the top automatically appear and you do not have to type them everytime.
Select method body, click on Edit and clear anything that might be present in the text area. Repeat the same for Constructor body. Now when you want to write JavaDoc comments for a method you simply have to type /** and hit CTRL+SPACEBAR. JavaDoc comments will automatically appear for the params that may be passed, return type of the method and any exception that it may be throwing. You only have to add the description for the method. Carry out the same procedure for Constructors under Comments group.
To see line numbers, go to Window � Preferences � Java. Click on the �+� sign and select Editor. Check/Uncheck the Show Line numbers checkbox to display/hide line numbers.

Some keyboard short-cuts:

To run a main method, instead of using the mouse to select Run from the menu and then select �Run as java Application�, hit CTRL+F11. This will run the last known Java application.
To switch between windows in the editor press CTRL+F6 and hold CTRL button. This will give you a list of open windows. Now use the UP and DOWN arrows to select the required window and hit ENTER.
Similarly to switch between Package Explorer, Console and Working Window use CTRL+F7.
To switch between perspectives (Java, J2EE, server etc) use CTRL+F8.
To search for a word in a file use CTRL+K to search in the forward direction and CTRL+SHIFT+K to search in the reverse direction.
If there is some piece of code that is not compiled due to missing import statements, select the particular word and hit CTRL+SHIFT+O. This will add all the required import statements and you will not have to write each missing import statement manually.
To find what code is present in between two braces, place the cursor next to the opening space and double-click. This will highlight the code that is present within that opening brace and the matching closing brace.

To ensure that each line of code is limited to 80 characters, right click in the window, go to Source and click on Format. The default line length limit for the editor is 80 characters so this will ensure that your line length is limited to 80.

If you need to rename a file and it is being used in a lot of places, select the file to be renamed in the java perspective, right click and select Refactor � Rename. Change the name of the file to the required name. You will get options to rename all the references, rename in all comments etc. Check the desired checkbox and click �OK�.

Stefan Willi
Ranch Hand

Joined: Mar 11, 2005
Posts: 47
On Sourceforge exists a project which provide a pdf with a collection of shortcuts.

Eclipse-Tools on Sourceforge

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks Animesh .
Really useful stuff .
Krish Pinnamaneni

Joined: Mar 16, 2005
Posts: 22
Hi Stefan Willi , Animesh,
Thanks a lot for spending your most valuable time to give response.
Sri Krishna.
I agree. Here's the link:
subject: eclipse3.x short cut keys.
It's not a secret anymore!