ที่มา : codeofdoom.com/
Anyone who knows me knows that I hate touching the mouse. I do not like using it one bit. If there is a shortcut on the keyboard, its a pretty big guarantee I am going to do my best to find it. Being a programmer, I spend a massive amount of time using Eclipse. Naturally I have a pretty good understanding of all the shortcuts that make my life easier. Here a list of shortcuts that can help you. Also a brief how to on removing the most annoying shortcut of all, show in breadcrumbs.
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+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.
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. Unfortunately, this never made it into Flex Builder (bummer), but I enjoy life when I get to use it in Java land .
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.
Alt+Shift+B. Show in breadcrumb.
This is something that might work great for some people. For me, it annoys the hell out of me. It puts a breadcrumb in your text area and it does not give you an easy way to get rid of it. So here is how you get rid of Show in breadcrumb.
Go to Window then customize perspective. In there, go to the Commands tab. For me, I used the Java Editor Presentation. But on the Toolbars details, you should see Toggle Breadcrumb with an icon of a C and an arrow. Click on that then click okay. On your toolbar (if it wasnt already there), you should now see that icon. Click that to turn it off.
Just like any other trade, the better you know your tools, the better you will be. I am not saying this makes you a good programmer, but it does make you more efficient. If you feel I left out any shortcuts that find essential, feel free to comment!