Ctrl + Space : One of the two most important keyboard shortcuts that eclipse offers. This one is probably commonly known for autocomplete in eclipse, but not many people know that it is also context sensitive. For example, hitting Ctrl + Space when you are in the middle of typing will show you all members and methods that begin with your text. But hitting Ctrl + Space when you have nothing typed shows you all members and properties available. But the real eclipse masters know that, hitting Ctrl + Space when you type in for or foreach will show you autocomplete options for generating a for loop or for each loop. And if you do it right after you assign something to a collection or a list, it will fill in the loop variables for the for each loop. Autocomplete after typing in test, will allow you to generate the skeleton of a JUnit test case method. Autocomplete after typing in new, generates you a skeleton for a new call, which you can tab through and fill in. So many more uses and use cases for Ctrl + Space that can be found. You can generate / override method signatures in child classes. Just use and abuse it, and you will learn so much.
Wednesday, 4 May 2011
Tuesday, 3 May 2011
Redirecting eclipse console output to log file
There is a way to redirect the console text into a log/text file under eclipse. If you are running a web-based application, possibility is that you already have a .log file configured some where. You can simply open this log file and look for messages.
In case of pure java application however, most of the output is showin in the eclipse console unless you configure a redirect.
Pull up the "Debug" or "Run" dialogs where you configured your main class. Select the java application you want to run. If you dont have an entry under "java applications", you might have to create one. On the right hand side of the screen, select the "Common" tab. Check the "File" checkbox and mention a physical path+filename in the input textbox. You are all set! Open the specified file in your fav text editor.
In case of pure java application however, most of the output is showin in the eclipse console unless you configure a redirect.
Pull up the "Debug" or "Run" dialogs where you configured your main class. Select the java application you want to run. If you dont have an entry under "java applications", you might have to create one. On the right hand side of the screen, select the "Common" tab. Check the "File" checkbox and mention a physical path+filename in the input textbox. You are all set! Open the specified file in your fav text editor.
Eclipse Shortcut : Open a type like class or Interface
Open a type (e.g.: a class, an interface) without clicking through interminable list of packages: Ctrl + Shift + T. If what you want is a Java type, this shortcut will do the trick. Unlike the previous shortcut, this even works when you don’t have the Java source file in your workspace (e.g.: when you’re opening a type from the JDK).
Thank you
Thank you
Eclipse : commonly used shortcuts
1) Ctrl + T for finding class even from jar
2) Ctrl + R for finding any resource (file) including config xml files
3) Ctrl + 1 for quick fix
4) Ctrl + Shift + o for organize imports
5) Ctrl + / for commenting , uncommenting lines and blocks
6) Ctrl + Shift + / for commenting ,uncommenting lines with block comment
7) Ctrl + o for quick outline going quickly to method
8) Selecting class and pressing F4 to see its Type hierarchy
9) Alt + right and Alt + left for going back and forth while editing.
10) Ctrl + F4 or Ctrl + w for closing current file
11) Ctrl+Shirt+W for closing all files.
12) Alt + Shift + W for show in package explorer
13) Ctrl + Shift + Up and down for navigating from member to member (variables and methods)
14) Ctrl + l go to line
15) Ctrl + k and Ctrl + Shift +K for find next/previous
16) select text and press Ctrl + Shift + F for formatting.
17) Ctrl + F for find , find/replace
18) Ctrl + D to delete a line
19) Ctrl + Q for going to last edited place
20) Ctrl + T for toggling between super type and subtype
21) Go to other open editors: Ctrl + E.
22) Move to one problem (i.e.: error, warning) to the next (or previous) in a file: Ctrl + . for next, and Ctrl + , for previous problem
23) Hop back and forth through the files you have visited: Alt + ← and Alt + →, respectively.
24) Go to a type declaration: F3
25) CTRL+Shift+G, which searches the workspace for references to the selected method or variable
26) Ctrl+Shift+L to view listing
27) Alt + Shift + j to add javadoc at any place in java source file.
28) CTRL+SHIFT+P to find closing brace. place the cursor at opening brace and use this.
29) Alt+Shift+X, Q to run Ant build file using keyboard shortcuts.
30) Ctrl + Shift +F for Autoformating.
2) Ctrl + R for finding any resource (file) including config xml files
3) Ctrl + 1 for quick fix
4) Ctrl + Shift + o for organize imports
5) Ctrl + / for commenting , uncommenting lines and blocks
6) Ctrl + Shift + / for commenting ,uncommenting lines with block comment
7) Ctrl + o for quick outline going quickly to method
8) Selecting class and pressing F4 to see its Type hierarchy
9) Alt + right and Alt + left for going back and forth while editing.
10) Ctrl + F4 or Ctrl + w for closing current file
11) Ctrl+Shirt+W for closing all files.
12) Alt + Shift + W for show in package explorer
13) Ctrl + Shift + Up and down for navigating from member to member (variables and methods)
14) Ctrl + l go to line
15) Ctrl + k and Ctrl + Shift +K for find next/previous
16) select text and press Ctrl + Shift + F for formatting.
17) Ctrl + F for find , find/replace
18) Ctrl + D to delete a line
19) Ctrl + Q for going to last edited place
20) Ctrl + T for toggling between super type and subtype
21) Go to other open editors: Ctrl + E.
22) Move to one problem (i.e.: error, warning) to the next (or previous) in a file: Ctrl + . for next, and Ctrl + , for previous problem
23) Hop back and forth through the files you have visited: Alt + ← and Alt + →, respectively.
24) Go to a type declaration: F3
25) CTRL+Shift+G, which searches the workspace for references to the selected method or variable
26) Ctrl+Shift+L to view listing
27) Alt + Shift + j to add javadoc at any place in java source file.
28) CTRL+SHIFT+P to find closing brace. place the cursor at opening brace and use this.
29) Alt+Shift+X, Q to run Ant build file using keyboard shortcuts.
30) Ctrl + Shift +F for Autoformating.
Shortcuts related to source code insertion Eclipse:
Sunday, 1 May 2011
Rules for java beans
1) There should be one no argument constructor
2) The class should implement the java.io.Serializable interface
3) There should be getter and setter methods for properties which are declared as private.
Subscribe to:
Posts (Atom)