Setting up Eclipse IDE for first time

I have worked with Eclipse IDE for a long time and I really like it. It helps me deal with a lot of problems in Java programming. In this tutorial, I will share with you all what I did to setting up Eclipse IDE for first time.

Setup Formatter

We need format our code follow a standard then other one can read and maintenance your code easily.

To setup formatter in Eclipse IDE, you should go to Preferences -> Java -> Code Style -> Formatter.

Setting up Eclipse IDE for first time

By default, Eclipse has its own formatter. You can use the default formatter configuration provided by Eclipse or you can build your formatter configuration.

I can share my formatter configuration here.

Setup Save Actions

This is one of great features of Eclipse. It helps us do something when we press Save button to save a file, for example: remove unnecessary import commands for unused imports, format the source code, remove unnecessary casts.

To setup it, go to Preferences -> Java -> Editor -> Save Actions.

Setting up Eclipse IDE for first time

By default, the option “Perform the selected actions on save” is un-checked. We need to check it.

Here, we have 3 child options as:

  • Format source code

By default, this option is disable. You can enable it by checking.

Format all lines: that means when we save our source code, Eclipse will re-format all code in current file.

Format edited lines: only re-format the code which was added or modified.

Both will use the Eclipse formatter configuration as I was mentioned in previous section.

  • Organize imports

In Eclipse, we can order the import commands by using Organize Imports feature.

This option allow us re-order our import commands using the Organize Imports configuration.

  • Additional actions

By default, this option is disable too and it configures some actions like: remove unnecessary casts, add some missing annotations. You can enable it by checking.

You can edit or add more actions which are allowed by clicking Configure… button.

Below is my Save Actions configuration:

Setting up Eclipse IDE for first time

Setup Errors/Warnings

This setup is very helpful for us to detect some problems we may have when programing with Java.

To setup it, go to Preferences -> Java -> Compiler -> Errors/Warnings.

  • Code style

Setting up Eclipse IDE for first time

  • Potential programming problems

Setting up Eclipse IDE for first time

  • Name shadowing and conflicts

Setting up Eclipse IDE for first time

  • Deprecated and restricted API

Setting up Eclipse IDE for first time

  • Unnecessary code

Setting up Eclipse IDE for first time

  • Generic types

Setting up Eclipse IDE for first time

  • Annotations

Setting up Eclipse IDE for first time

  • Null analysis

Setting up Eclipse IDE for first time

Chia sẽ bài viết này ...Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Add Comment