Xtreme Eclipse 4: A tutorial on advanced usages of the Eclipse 4 platform
Now that the new Eclipse platform is more than one year old, advanced Eclipse 4 applications are beginning to surface and many more remain unseen within corporate walls. To keep you on the technical bleeding edge of what is happening and what will happen we will examine three important aspects of the platform development:
- Customizing dependency injection behavior with custom annotations
The classic way DI works in Eclipse is that you have this scoping mechanism called IEclipseContext which is a key-value store and acts like a source of injections. Every injection request goes and looks inside it for a key and, if found, gives a value. But the DI engine leaves a hook for customizations and we will show how you can take advantage of it, be it by creating new annotations or by having injections from outside data sources.
- Exploiting rendering flexibility with customized renderers
The renderer is responsible for turning the abstract model elements into an SWT widget which is visible to you. So, with the default renderer, the MWindow model element gets translated to a SWT Shell, the MPartStack to a CTabFolder and so on. But it doesn't have to be like this if it doesn't match your needs. It can be different. In fact this is the most explored route in customizing the platform. We've seen renderers producing custom SWT widgtes and also completely other UI toolkits taking advantage of the modeled workbench and dependency injection to build alternative application frameworks. We will explore this path also.
- Bending the application model to your will
An Eclipse 4 application is modeled. There is a model beneath what you see. This model defines the heart of the application structure and behavior. Things like 'An application has one or more windows', 'A window has perspectives', 'An application has commands', 'A part stack contains a bunch of parts (views)' are rules set by the model. You will be shown you can bend those rules. You may imagine an RCP application in which parts contain sash containers and part stacks inside them, you can create new rules mixing the actual model elements and creating new ones. Hook a custom renderer to these and you have your tailored platform which can boost your productivity in developing multiple RCP applications which fit your needs.