Taking a break with Jeff Dunham

I purchased tickets for Jeff's show back in February for Valentines day – we finally saw him Sunday night. The concert was the Spark of Insanity tour and was absolutely hilarious. You have to have a pretty opened mind and not be sensitive (of course). If you get a chance to see his show its well worth it. You can see his tour schedule here.

You can get a sneak preview here:

Advertisements

SWT/JFace In Action

More and more Notes developers are diving into the Eclipse site of the equation. One of the books I used as a good primer was the SWT/JFace In Action book from Manning publishing. The book is a great resource for learning about SWT programming and architecture. The one I had was for Eclipse 3.0 and a lot of it is still relevant but much has also been added in the last few releases.

http://www.assoc-amazon.com/s/link-enhancer?tag=bobsblog0b-20&o=1

Adding custom launch items to the “Open” menu

Lotus Notes has a very cool UI where you can contribute launcher items to the Open menu. You can not only contribute bookmarks and databases but you can create a custom handler to have just about anything launch from the Open menu.

You can check out the Info Center help here where it shows you how to add a contribution to the menu. The one area the help does not go into is the handler implementation (TestURILauncherItemHandler()). The great thing is the object passed in just needs to extend org.eclipse.core.commands.AbstractHandler and override the execute event. So really, you can pretty much do whatever you want in that method.

From the help in the info center here are the out of the box handlers that get installed with the platform:

* nativeProgramLaunchItem — Identifies the item as being a NativeProgramLauncherContributionItem class, which is a contribution item that starts a native program.

* perspectiveLaunchItem — Identifies the item as being a PerspectiveLauncherContributionItem class, which is a contribution item that starts a standard client application by specifying an Eclipse perspective.

* urlLaunchItem — Identifies the item as being a UrlLauncherContributionItem class, which is a contribution item that opens a URL.

Tags: : :

Creating extensions dynamically

I have been asked a few times how we create perspectives dynamically in Lotus Expeditor and Notes in the composite application space. We actually create many extensions dynamically using the Eclipse RegistryFactory API. The getRegistry() method returns an instance of the extension registry factory (IExtensionRegistry) where you can call addContribution(). Once this method is called the extension becomes available for use – usually reflected in a toolbar, menu, etc.

What would this kind of stuff be good for?

Say you have data stored in some other format – like an NSF, database, a external system – and you want that to be represented as some existing extension. You can now dynamically create those extensions from those other sources. This is exactly what we do for perspectives and other extensions in composite applications.

Another great sample would be to clone an existing perspective but maybe add a different context to it. For example, you could have your IPerspectiveFactory class create the layout for your perspective and base the contents on the Page data stored in the composite application model. This would allow your perspective to use this data space to initialize views and the data that is used in them. This means you could then contribute a special launch contribution item to the Open menu, dynamically create a new perspective off of the current workbench selection and initialize that perspective with the selection data. This would be yery similar to the Web Browser and Symphony documents. Your perspective may be a “user session” for a banking application. Each perspective may be a specific customer profile – so when you open up multiple instances of this perspective they would all point to different customers.

The cool thing about using page and component data is it can be conditionally used. You can use core Eclipse API's to get the data and if nothing is returned then its not available – if the data is returned you can use it! Check out the Wiki page I wrote about this model.

Tags: : :

To see code samples
The code below has a variable called buffer. The contents of buffer simply need to be the XML you would normally use for a plugin extension. For example, the buffer could be this xml:

<perspective
name="Test"
class="org.eclipse.ui.articles.perspective.TestPerspective"
id="org.eclipse.ui.articles.perspective.Test">

That sample plugin xml code came from the Using Eclipse Perspectives article.

byte[] bytes = buffer.toString( ).getBytes("UTF-8");
is = new ByteArrayInputStream(bytes);

IExtensionRegistry registry = RegistryFactory.getRegistry( );

if (!registry.addContribution(is, contributor, false, null, translations, null)){
//Log an error or something
}

Unfortunately there are some caveats to the call. The one major problem is the “persist” flag does nothing today. So if you want your contributions to be available on next launch you need to do this every time.

The new Legos

Ok, my kids loved lincoln logs and Legos – and actually still use them a lot – mostly legos. Now, my kids (even my five year old), only want to create maps in Halo 3. They are creating some amazing maps and doing all sorts of things with the map building tool. Floating crates, weapons, etc. I watch them use the Halo tool and I am amazed by the user interface Halo has created for this. I hate to say it but Microsoft actually did something really great. I love the XBox and I love their games – and to have a 5 year old pick up such a complicated tool is pretty impressive.

This reminds me of other games like Zoo Tycoon – another very popular game among my kids. They learn so many things by these games it amazes me. My youngest tells me what kinds of shelters and food certain animals like. Very cool.

Tags: : :