Eclipse Design Patterns – Singleton in Platform

Actually this is the simplest pattern in this Eclipse Design Patterns series. The basic idea of a Singleton pattern is there is always only one instance for a target object.

The following simply gives several examples from commonly used Eclipse API. Note that not all methods are from org.eclipse.core.runtime.Platform.

Platform.getAdapterManager(); //only one AdapterManager
PlatformUI.getWorkBench(); // only one workbench
//get workbench window
ResourcesPlugin.getWorkspace(); // only one Workspace

For more examples, you can browse the source code of eclipse.

Category >> Architecture & Design  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
String foo = "bar";