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 AdapterManagerPlatform.getAdapterManager(); //only one … Read more

Eclipse Design Patterns – Strategy in SWT

Design patterns used in SWT is relatively straightforward. SWT is an independent module in Eclipse platform. In brief, Strategy let client dynamically set the strategy it should use. Strategy is different from State. First of all, Strategy is simpler since it is only about using interface instead of concrete class. Secondly, State involves changing the … Read more

Eclipse Design Patterns – Composite in Workspace

Composite in Workspace Composite pattern defines a tree hierarchy which lets clients treat objects in the hierarchy uniformly. In Eclipse Workspace, IWorkspace is the root interface and it is a Composite of IContainers and IFiles. Here is the interface hierarchy diagram. Code Example Here is an example to show how to get projects under Workspace. … Read more

Eclipse Design Patterns – Proxy and Bridge in Workspace

1. Proxy and Bridge pattern in Core Workspace The most important design patterns used in Core Workspace is called “Proxy and Bridge”. The most confusing question is about which part is proxy or which part is bridge. The following diagram use IResource for demonstration, others are similar such as IFile, IFolder, IProject, IWorkspaceRoot, etc. In … Read more

Decipher Eclipse Architecture: IAdaptable – Part 1 – Brief Introduction

If you read Eclipse source code, you will find that IAdaptable is a very popular interface which is implemented by many others. Why do so many classes/interfaces implement IAdaptable? The answer is that Adapter is the core design pattern for eclipse Core Runtime. What is IAdaptable? public interface IAdaptable { /** * Returns an object … Read more

Eclipse Plug-in Architecture – Extension Processing

This post starts with the question – how the callback method is called in Eclipse Platform.

Short answer is: call back method is called by host plug-in.

The example used is from a previous post which is about creating a sample plugin with a menu through plug-in wizard. I believe anyone who have played a little bit with plug-in has used it before.

Read more

Decipher Eclipse Architecture: IAdaptable – Part 3 – Show Properties for Items in a View

This example shows how IAdaptable is used in Eclipse in a real example. To get a taste of how Adapter design pattern works in Eclipse, go to those posts: post1 post2. Suppose you have created a view by using eclipse “Extension wizard”. (If you do not know this, try to play around and get this … Read more

Decipher Eclipse Architecture: IAdaptable – Part 2 – Simple Example

Adapter Design Pattern How Adapter design pattern is used in Eclipse platform? Eclipse Platform Runtime has a good example of this pattern. First of all, Adapter design pattern has a simple idea behind – wrapping the object and making it to be compatible to another interface clients expect. You can take a look at the … Read more

Design Patterns Used in Eclipse Platform

Here I summarize the design patterns used in Eclipse platform. Understanding design patterns used in Eclipse is the key for understanding Eclipse platform. Eclipse architecture has a clear layered structure. Each layer is independent to each other but interactive with each other. To better understand a framework, it is a good idea to start from … Read more

OSGi Framework Architecture – Three Conceptual Layers

The OSGi(Open Services Gateway initiative) framework provides a dynamic modular architecture which has been used in many applications such as Eclipse Equinox, Apache Felix, etc. Understanding how OSGi framework works is useful for developing Eclipse plugins and many other molecularity applications. In this article, the high-level overview of the architecture is explained. OSGi framework architecture … Read more

Plug-in Mechanism of Eclipse

Eclipse platform is built on OSGi framework. Eclipse Plugin framework is pretty complex. However, the general ideas behind is very simple. In this post, the simple idea of how a plugin works is explained by using a diagram. Then a simple Eclipse Plugin is created to explain how to add a menu item to menu … Read more