This is a template for easily creating an implementation of the Singleton Pattern on Eclipse. Open Window->Preferences->Java->Editor->Templates click on New and insert the code below on the pattern text area; add a name (I suggest "singleton") - whenever you type this name and press Ctrl+Space the code will be inserted in your class - and you're good to go.
1
2 private static ${enclosing_type} instance;
3
4 private ${enclosing_type}(){}
5
6 public static ${enclosing_type} getInstance(){
7 if(null == instance){
8 instance = new ${enclosing_type}();
9 }
10 return instance;
11 }