Jun 28 2008

Eclipse (anti)patterns (1).

Published by at 8:59 am under Eclipse,IT,Java

Activator is a class in a Eclipse plugin which controls the plug-in life cycle. It contains methods like start(BundleContext context), stop(BundleContext context) and a static method Activator getDefault() – which returns static field plugin. What is interesting the the static field plugin is set in the non-static public method start(BundleContext context) or in a public constructor.
Such code is generated by Eclipse wizard for creating new plug-in. And this is Eclipse pattern for accessing the shared instance

Actually there are more places where this pattern is used in Eclipse framework and very often it is the only way for obtaining a reference to particular object. Let me discuss those later.

No responses yet

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.