Tuesday, June 22, 2010

Eclipse key board shortcuts -Techies

Eclipse key board shortcuts :


Ctrl+space. Autocomplete.
This will recommend a list of classes they will fit what you have typed so far. If there is only one match, it will just print it out for you. After it does print it out for you, it will include the import for you. If something is ever missing the import at the top, I will just go to the Class declaration and just hit Ctrl+space.

Ctrl+Shift+O : Import packages:
This is very much required when we have to import packages for classes. (Organizing)

Ctrl+Shift+R. Open resource.
I cannot live without this shortcut. It is such a time saver. Whenever you are trying to find a specific class, just start typing it and it will populate which classes match that criteria. Once you found it, select it and there you go! It also works great if you are new to a framework and need to find certain classes or if you partly recall the class name but not 100% sure.

Ctrl+O. Show inherited members.
This is another one that works great when you are working with classes with a massive lump of methods attached to it. You COULD do this within the Package Explorer, but no one likes touching that mouse! You can even type to filter down your methods. If you have methods with the same name and just different parameters, this also works great. Just type in part of the method name and get a few overview and access to each of the methods.

Ctrl+H. Loads search box.
I cant tell you how often this saves me. This isnt just a ‘find’ box, this does a ‘find in files’ within the File Search tab. Within here, you can specify what you are looking for in the files, what you file types you want to search in, etc. There are other types of search you can use, but I have not run into a case where I need them. Have you?

Ctrl+Shift+C. Comments a block of code.
This is perfect for debugging. It is strange because really when you think about it, you are only talking about having something put a /* at the begging of what you selected and a */ at the end of what you selected. However, I use this a lot more often than you would expect.

Ctrl+D. Delete a line.
Self explanatory. Extremely useful. If I didn’t have that, I’d have to waste time with Shift+End, Delete!.

Ctrl+E. Menu for opened files.
This will bring up a list of opened files that you have. Not only that, it will also allow you to type in your class names to narrow down your choices.

Ctrl+Shift+E : Window for Opened files:
This key is used to view all the files opened in the editor , where it will be easy to identify & open the files .

Ctrl+1:
Is used for renaming variables at a time through out the file. Will be useful when we want to rename the variable name where the variable being used at many places.

F4. Shows class hierarchy.
This is extremely useful when you are new to a with a massive framework and you really want to get a sense of how things are all connect, who extends what, etc.

F3 and Ctrl+Left Mouse Click. Shows declaration.
I enjoy using this when I am working with larger files or anything with long methods (which always irks me). It can get extremely annoying to see where some variables are declared. All you have to do is high light the variable then hit F3. Sometimes I will hold control and hover over variable names if I am having a problem.

F5, F6, F7, F8. In debug mode.
There three shortcuts are probably used more than anything. I wanted to group them all into one section.

F5 – Step Into. When you are debugging an application and you come across a function call, F5 will step into that function and proceed from there.

F6 – Step. This allow you to debug line by line. However, this will not step into any functions.

F7 – Step out. If you are debugging in a function and you want to step out of it to where the function was called, this is what is used.

F8 – Skip to next breakpoint. If there arent any other break points to high, you will be just running the application until your application hits another breakpoint, taking you back into debug mode.

Alt+leftarrow or Alt+rightarrow. Jump back to a line, Jump forward to a line.
According to eclipse, this is “Next word, Previous word’. I am not sure what that means. All I know if I am stepping into functions, debugging through multiple files and breakpoints, this is a life saver. It allows me to retrace my steps, step by step. If I go back with Alt+leftarrow, I can go right back to where I was with Alt+rightarray.

Ctrl+Shift+L. Displays all shortcuts.
Self explanitory. Dig in and find your favorite!This last one is not about using a shortcut. It is about what you have to do to turn it of.

Ctrl+W or Ctrl+F4: close the single file.
This is used to close the current file that is opened in the editor.

Ctrl+Shift+W or Ctrl+Shift+F4 : Close all the files:
When many files we have opened this is very much useful to close all the files opened in the editor in a single shot.

Alt + left key : Navigation
This is used to navigate from one page to another page in the left direction .

Alt+right key : the same as above for right navigation.

Ctrl+Shift+/ : comment
This is used to add the block level comment in a page.

Ctrl+Shift+\ : remove comment

Ctrl+Shift+F : Formatting contents

Save your time using keyboard.......
 
Rocking,
Shyamala

Saturday, June 19, 2010

ECLIPSE DEBUGGING TUTORIAL

Debugging Using eclipse :

Let us consider one simple Java project :

Where i have created in the following manner.












Presently it is in java perspective.......

we can change the perspective into debugging by clicking WINDOW-->Open perspective ---> and go

to other and select “Debug”.

Then :











We can add the break point lines by double clicking on the line in source code...

  • You can observe clearly there are areas EXECUTION STACK,WATCH VARIABLES AND EXPRESSION AREA,SOURCE CODE Area,and as well CONSOLE SCREEN.

Observe the following screen shot to add watch expression as well as execution environment













  •   By using F11 key we can start debugging any Java application.
               Here in this case i have added two watch expression one is “i” value and another is “str1” value.

  •   By using F6 key we can do step by step execution of a program.

  • By using F8 key we can skip the current break point it will be jumping into the next break point start.

 Observe the next screen shot which shows the values of “i” & str1













Thats it ..............

This is simple debugging of Java application.

JUST SCROLL DOWN........













This is how it will be after termination of Program...which stops with THREAD....

Very much required as a developer to know how to use Eclipse debugging ......as in the real world applications development no body will prefer using System.out.println();......


So be the best by learning & practicing this .....

Keep Rocking
Shyamala