|Extension Point Modeling Framework [message #772527]
||Thu, 29 December 2011 20:17
| Duncan Krebs
Registered: June 2011
Location: Bay Area / Mexico
I've been developing in eclipse for some time and a few years ago I wrote a component that if you know of the apache commons digester component you write a set of rules based on xml schema for object instantiation property setting and setter calling (like a stack and when this <person> element is reached created a Person object, set properties like name and on </Person> pop it from the stack and call addPerson to the parent object.
So using that approach for all the extension points I have I write a set of rules based on the extension point xsd so that I then have a ExtensionRegistry with all POJO objects that model the extension points which is a lot easier than going through the hard to use and tedious extension API. I also have a special rule that will set the contributor plugin so I know what bundle contributed a specific extension.
It would be nice if we could create a tool that looks at the extension points in a plugin and then does code generation to create a "ExtensionRegistry" class and "ExtensionRegistryProcessor" where the processor gets called at plugin activation and for each extension point a POJO bean is created and in the extension registry object you can then say like getActionSets() or getViews() or whatever your extension points are instead of having to go through the Eclipse ExtensionPoint API. In runtime there would be no additional dependencies other than maybe common beanutils and the ide feature would work something like this.. create an extension point for example clockListeners and a clockListener element that has an id attribute and a class attribute that implements IClockListener, then in the tool kind of like of EMF there is a object model that is auto generated from looking at al the extension points then a generate code action that syncronizes your ExtensionRegistry with the current extension points you have defined.
Then this way, to create an extension point you simply define it in the editor. run the code generation tool and have a reference to the registry on the plugin activator to say registry.getClockListeners().
Free time is something I don't have much of, but I'm getting tired of having to create the bean and rules manually and am wondering if people think this could be a useful approach or see any potential flaws. Would be also nice to use EMF and create an EMF ecore based on the extension points for the plugin but that would be an additional emf dependency that some RCP apps would not want but would make development faster. Call it something like Extension point modeling framework or Extension Cruncher
- Duncan Krebs
Powered by FUDForum
. Page generated in 0.01443 seconds