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�.