How to find quickly anything in Eclipse


One of the new-and-noteworthy features in Eclipse is Quick Access . Even if you're a fan of the mouse, this keyboard shortcut can save time and money.

The Quick Access -which is activated by Ctrl + 3- is your window to anything; perspectives, views, open editors, commands, menus ... just start typing, and it will show you the possible matches. It filters the most likely ones first, but if you press it again, will show all the possible matches that it knows about.

 

Eclipse tips tricks tutorial

This is the quickest way to fine ANYTHING oin Eclipse.

 

How to open an Eclipse file from Windows Explorer 

 

Sometimes it can be necessary to operate on your project files from the Windows Explorer. The less efficient way to achieve it is by
selecting the file properties, copying and pasting the file name in an Explorer window.

 

There's an easy way to do it, by configuring Explorer as External Tool.

 

In order to do it: Create an external tool with location ${env_var:SystemRoot}\explorer.exe and arguments /select,${resource_loc} .

eclipse tips tricks jboss

Any selected file or directory can now be shown in the windows explorer.

 

eclipse tips tricks

 

How to check the history of a file


Well, every real world project should be committed on a repository like SVN or CVS. Eclipse however has its own repository containing the history of your files.
This can be very useful to revert changes when necessary....or just in case you forgot to commit the file on the repository!

To use this feature, right click on the file of your choice and click Compare With -> Local history. That should open up the entries in the ‘History’ view.

 

Clicking on any of the history entries will open a diff window telling you the difference between the current entry and the previous edits.

 

Use Templates !

 

Templates are one of the greatest time savers for Eclipse developers, yet not all users are aware of them. A template is a block of text which can be inserted in your code. It's much more powerful concept than cut and past since it may contain some dynamic pieces of code as well.


To see the list of built-in templates and to define new ones go to Window -> Preferences. Select Java -> Editor -> Templates. You can add your own templates here.

 

How to trigger a template: simply type in your editor the template code and press ctrl+space. For example type if you have defined a template named sql, just type sql and ctrl+space to activate the template.


eclipse tips tricks

 

 

Code template variables:

Eclipse can automatically fill out dynamic code by sniffing out variables in a template. Here are a few you should make yourself aware of

{xtypo_code}${cursor} - Place the cursor here after code completion
${enclosing_method} – Replace this with the method name where the code completion was called.
${enclosing_method_arguments} – Replace this with the enclosing method arguments
${enclosing_type} – The enclosing class name
${import} – Dynamically import some classes
${importStatic} – Same as above but with static imports
${time} – Current time
${todo} - The //TODO eclipse task{/xtypo_code}

And here are a few interesting templates which can be imported in your project:

Singleton Template:

{xtypo_code}private static ${enclosing_type} singleton = new ${enclosing_type}();

private ${enclosing_type}(){
}

public static ${enclosing_type} getInstance(){
if(singleton == null){
singleton = new ${enclosing_type}();
}

return singleton;
}{/xtypo_code}

 

Log4j Template: (Defines a logger for the current class)

 

{xtypo_code}${:import(org.apache.log4j.Logger)}
private static final Logger LOG = Logger.getLogger(${enclosing_type}.class);{/xtypo_code}

 

How to set the proxy address in Eclipse


Well, most developers use Eclipse at work behind a proxy so it's absolutely a must to configure the proxy for keeping your libraries updated. Well the good news is that newer releases of Eclipse are able to read your browser's Proxy configuration, so it should work automatically.

 

If you have got an earlier Eclipse release or simply you want to customize your Proxy configuration, just point to Window > Preferences. Under the General element you can find the Network Connections panel which contains the proxy configuration.

 

Eclipse tips tricks

Choose "Manual" to provide a custom proxy configuration. In the bottom part of the screen, you will be able to exclude the addresses which you don't want to hit with your proxy.

 

References: http://www.eclipsezone.com/eclipse/forums/f18111.html

Do you want more Eclipse tips and tricks ? read this !

0
0
0
s2smodern