Wednesday, February 20, 2008

Total Lunar Eclipse

It looks like it is going to be a clear sky for tonight's total lunar eclipse. Hmm...I thought I would have heard more about it in the usual Eclipse news channels today. The event should start around 8:45pm (EST) with the total eclipse happening at around 10pm (EST). If you live in Toronto, you could always attend the free* party.

*Free? I should hope so! I know I wouldn't pay to "look up".

Sunday, February 10, 2008

Updating UI Elements From Command Handlers

I struggled a bit with this tonight so I figured it was worth a post. I am piddling around with command handlers as part of my background work for my upcoming talk at EclipseCON (should I keep plugging EclipseCON, or is that enough already?), and one of my simple samples was building on the Hello World, Command PDE sample. I wanted a simple toggle command instead of the default push-style command, but I could not get the menu item to toggle state (checked versus unchecked) when I executed my command with the keybinding. A little searching led me to this newsgroup post, and an eventual solution.

The secret sauce seems to be:

Make your class implement IElementUpdater:

public class SampleHandler extends AbstractHandler implements IElementUpdater {

Implement said interface with your required logic (this code is for my particular case):

public void updateElement(UIElement element,
Map parameters) {
element.setChecked(this.image != null);

Now, you need to get the command service to call updateElement. The easiest way to do this is in your execute method like so:

public Object execute(ExecutionEvent event) throws ExecutionException {

//... actually do something here ...

// Refresh the UI elements
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
ICommandService service = (ICommandService) window.getService(ICommandService.class);
service.refreshElements(event.getCommand().getId(), null);
return null;

Saturday, February 9, 2008

StSanders Banned!

Apparently YouTube has pulled all the StSanders videos for copyright infringement, according to Wired. I guess it is their policy to pull videos after three complaints and someone complained a third time. Rumor has it Yngwie Malmsteen may have been one of them.

I'm not sure how you can not have a sense of humor about something like this. Just watch this video and tell me it is not hilarious:

Haha - that one has to be my favorite. I can't imagine the effort that went into overdubbing some of these. Anyway, Wired Video is mirroring them all anyway. I guess they don't have any sort of copyright infringment policy. ;)

Wednesday, February 6, 2008

PDE Nuggets

I find myself constantly amazed at the hidden gems you can find in Eclipse. Today's nugget is brought to you by the PDE, and is the Plug-In Registry View. I found it very useful while playing with namespace wackiness for my upcoming EclipseCON talk.

Some of you may say "What's so new about that?". Well, what can I say - I'm a little behind the times I guess. Most of my extension development has been done in Eclipse 3.2 or earlier, and this view seems to have appeared in Eclipse 3.3, so I'm sure there are others who don't know of its existence. (Correction: It looks like this view has been around far longer than that; as early as Eclipse 2.0, in fact. It just did not look or behave the same.)

I'm a little disappointed, however. I had this plan to write my own "extension registry spy" plug-in as sample code to accompany my presentation, but this view already does most of what I was going to implement. Oh well, I guess I'll have to think of another application to hack on for sample code purposes.

I guess it's more of a diamond in the rough than a gem as there are still some limitations and little bugs to be ironed out, but it is worth a look. So if you're a plug-in developer - check it out:

Window > Show View > Other > PDE Runtime > Plug-in Registry, or simply press Ctrl+3 (another Eclipse nugget), type "plu", and select it from the list.

Monday, February 4, 2008

An Empty House

Well, we got Michelle off to the airport and back home last night and she managed to make it home to Glasgow with only one minor injury. Turns out she took a nasty fall one morning last week and dislocated her knee-cap! I've updated the photos in the gallery, so you can see her stylish knee brace there. So not only did she get to see real Canadian snow, she also got to experience our health care system first-hand with a three-hour stint in the emergency room. Welcome to Canada!

Thanks for visiting and staying with us Michelle, we had a great time and we hope you did too (despite your Canadian ice-induced injury)!