In the last week I created my first Eclipse extension point template. Once again I am amazed with the ease and power of another rarely mentioned yet powerful Eclipse PDE feature. After going through the exercise I think all extensions should have at least one template. I have an extension point that takes in a class file (which implements an interface), an XML file (WSDL to be exact) and then some other attributes. The problem with the extension point is the WSDL has custom bindings that do not come for free with the WTP WSDL editor. So in short, unless the WTP WSDL editor is extended, creating this WSDL from scratch can be cumbersome. I also think the linking of the class with whatever interface is needed should also come for free.
What is a template you ask?
Here is a screen shot of what I am talking about:
You can have as many templates as you want for any of your extension points. The ActionSets extension in that screen shot creates the extension and the java files associated with them. I actually referenced the Eclipse code in the UI package to figure out how to do this (once again, open source allowed for this). I can not say how valuable it is to be able to just look at source and figure things out. Unfortunately the quick searches I did for this subject yield poor results (of which I am sure someone will respond to this and provide better search results).
You can look at a lot of good template samples under the package org.eclipse.pde.internal.ui.wizards.templates in the org.eclipse.pde.ui plugin. The SampleAction template is what is displayed in that screen shot above.
What makes this concept so interesting is how you can put tokens in the file names and code that are wrapped in $’s and they will automatically be replaced by the fields you specify on the wizard forms. For instance, you add a text field to the wizard page and give the field the name className and wherever “$className$” is in the template directories it will be replaced with the users input.
In the case of the ActionSet extension template there was a file named $className$.java and the contents of that file start with this code:
| package $packageName$;
import org.eclipse.jface.action.IAction; /** |
Every place you see the $xxxx$ tokens they will be replaced with the user input and of course this includes file names. The files are also processed in a very specific manner and the JavaDoc explains it very well for the generateFiles() method in the OptionTemplateSection class. Here is the doc for that field:
Generates files as part of the template execution. The default implementation uses template location as a root of the file templates. The files found in the location are processed in the following way:
- Files and folders found in the directory
binare copied into the target project without modification.
- Files found in the directory
javaare copied into the Java source folder by creating the folder structure that corresponds to the package name (variable
packageName). Java files are subject to conditional generation and variable replacement.
- All other files and folders are copied directly into the target folder with the conditional generation and variable replacement for files. Variable replacement also includes file names.
I would have liked to post some sample code but I do not get paid for this so oh well.
Happy template creation!
References
Eclipse documentation Extension Templates
The sample application shows how different components (portlets, SWT views, etc) are aggregated by the portal and wired together using the Portal Admin UI. We demonstrate Portlet to SWT, Portlet to Portlet and SWT to SWT communications. I will also be presenting the week after in Baltimore in the U.S. version of the conference. Article on CNN: Japan orders Apple battery probe Composite applications aggregate a set of components into a single, coherent entity. The individual components and the interactions among these components can work together to implement complex business logic as defined by a business user. Components of a composite application can be virtually any code artifacts including Java™ classes, portlets, EJBs, or plain old Java objects (POJOs). Meta data describes the behavior and configuration for each involved component such as a reference to a document library or a workflow definition. As we all knew it was very hot in Vegas last week. I was pretty much disconnected while there and had the luxury of coming home at 11pm and flying to Austin at 6:30 the next morning! So in short, blogging has taken a second place to fun, travel and work. We only saw one show in Vegas and I think if we go back we will probably schedule to see more prior to going. We didn’t lose our shirts and since I am still blogging and working we obviously did not beat the house. Chris and I are off to Las Vegas! We leave in about an hour for the airport to spend the night and first thing in the morning we are out of here. I am hoping it will be cooler out in Vegas but apparently it is hotter in the desert than upstate NY. Get your bets in now, I will lay down any amount of money (for those I deem are good for it) on a game. I will be returning next Monday but I hope to blog some pictures while I am there. Looks like I might be working on some bugs for work also… If you are in town let me know, we can have a cocktail! IBM’s Lotus Portal 6.0 is sweet, try it out! Disclaimer: Portal Technical Conference
On Monday I am off to present at the IBM WebSphere Portal Technical Conference in Stuttgart Germany. My talk (Extending Portal for offline and managed clients) is on Wednesday and it is about taking your portlet applications off-line with the Lotus Expeditor along with integration of your portlet applications with Eclipse based applications.
Looks like Apple Batteries are next to go up in flames
This is probably an issue to some extent but I sometimes wonder the real conditions these laptops are going up in flames. I know my Thinkpad laptops are very hot (actually the T60p seems to be cooler than the T40′s). How much of this is hype and how much is reality?New article on Portal 6 Composite Applications
The model is used in the up and coming release of the Lotus Expeditor 6.1.
Lotus Notes versus Outlook
Network Speed Test
Vegas was hot and fun
Off to Vegas
Las Vegas, NV 89119
Portal 6 is the new dance in town!
This is what you get when you try to dance with Mambo:
This advertisement has no affiliation to IBM or any of it’s products and is clearly not representative of any IBM backed marketing campaign.
Battery car smokes!
![]()
The Tesla Roadster is powered by 6,831 rechargeable lithium-ion batteries — the same cells that run a laptop computer. Range: 250 miles. Fuel efficiency: 1 to 2 cents per mile. Top speed: more than 130 mph. The first cars will be built at a factory in England and are slated to hit the market next summer. And Tesla Motors, Eberhard’s company, is already gearing up for a four-door battery-powered sedan.
I really like the fact that people are making alternative “cool” looking cars however I am not sure if 6K of batteries is the answer…



