Archive for February, 2006

More code templates in Eclipse

Tuesday, February 28th, 2006

How about this…

Start typing the name of a method (where a method should go). Don’t worry about the return type or anything else, just the name. Hit ctrl-space. Eclipse will offer to build a new private method with that name. Type “main” and hit ctrl-space and it will build you a new main method stub (complete with all the necessary parameters and return types).

Or… highlight a few lines of code in an existing method and hit ctrl-space. Down near the bottom of suggestions are a few interesting ones, including “do”, “for”, “if”, “runnable”, and others. Select one of these and it will wrap the selected code with a “do” loop, “for” loop, and so on. “Runnable is my favourite; it wraps the code in a new instance of java.lang.Runnable instance.

So…

  private void whatDoYouGetWhenYouMultiplySixByNine() {      doSomething();      doSomethingElse();  }

becomes…

  private void whatDoYouGetWhenYouMultiplySixByNine() {      new Runnable() {          public void run() {              doSomething();              doSomethingElse();          }      }  }

The best part is that if you look at how these templates are defined, it’s pretty easy to sort out how to define your own. More on that later…

Code Template Expansion in Eclipse

Monday, February 27th, 2006

Eclipse is great for lazy folks like me. By typing just a few keystrokes and hitting “ctrl-space”, Eclipse will generate a lot of code for you. For example, if you open a Java editor, move your cursor to a blank line and type “sysout”, it will expand what you’ve typed into System.out.println() and conveniently put the cursor between the parentheses.

I tend to use “toarray” a lot. This one is handy for converting a collection type into an array; it changes “toarray” into (type[]) collection.toArray(new type[collection.size()]). Even better, it put focus over the replaceable bits in the template and lets you tab through them. At first, it will put focus on “type”; anything you type there will appear in both places the word “type” appears. When you hit tab, it will move focus to “collection”. Very handy when you’re up against Java weirdness (you have to admit that the mechanism for converting a collection into an array is just weird looking).

There are a lot more templates. You can see the list that applies to the Java editors in the preferences dialog (Java > Editor > Templates).


Go ahead. Be lazy. You’re in good company.

Finally… a home for presentations, code, and other stuff…

Monday, February 27th, 2006

I’ve made a new page on eclipse.org for evangelism-related stuff. Included there are presentations from events (including the Eclipse in Motion seminar), source code (so far, I’ve only posted the code for a that eBay RCP application I keep droning on about).

I’m going to try and add some spice to the page. First, I’ve included a few graphics (it’s a start) including a tiny new vanity shot of yours truly. I haven’t quite decided if the picture embarasses me or not. Time will tell. I’m going to add some pictures and I’m also going try to prune down the text so that the page isn’t nearly so dull.

Anyway, I hope you enjoy the content.

LinuxWorld Boston 2006

Monday, February 27th, 2006

I sent in my talk for LinuxWorld Boston 2006 on Friday. Friday was the deadline and I do try to take deadlines seriously. As you can see from the fancy graphic on the left, the conference is in the beginning of April; I hate having to submit a talk so far in advance since I tend to tweak my presentations right up to the minute before I present. Still, I understand why the organizers want to have the talks, even if I don’t necessarily agree it.

I’m not a huge fan of printed handouts for presentations. It gives me great pain to see the stacks of unused printed handouts destined for the landfill at the end of the conference. I try to craft my presentations so that there’s not a lot of content on any single slide. I generally try to avoid lengthy chunks of code or anything that audience members cannot reasonably see from the projector. And… in my humble opinion, most of the interesting things that I say aren’t in the slides anyway. You have to pay attention to me, not the handouts if you want to get value from the talk.

Anyway, I really hadn’t intended for this blog entry to dissolve into a rant against printed handouts, so I’ll move on…

I’m speaking on the topic of building applications using Eclipse Rich Client Platform (RCP). The hook for the LinuxWorld conference is the ability to deploy your applications on multiple platforms. I’ve done a lot of work on the talk and plan to continue to tweak it even though what I finally present will differ slightly from the handouts. If the situation permits, I’ll run through the presentation during the Eclipse in Motion code camps this week and will be presenting at least some parts of it for the RTP WebSphere User’s Group.

In the meantime, what do you think? Is the environmental impact of printing a bunch of handouts worth the value you get back from them? Do you actually keep the handouts? Do you throw them out before you leave, or after you get home?

Image View plugin

Thursday, February 23rd, 2006

I do all of my editing of the pages on eclipse.org (including editing articles for Eclipse Corner) using Eclipse Web Tools. I personally don’t mind looking at HTML, and the HTML editor provided with Web Tools is top-notch (a lot of the content on eclipse.org is represented in XML, which Web Tools handles quite well also). So, I basically have everything I need. Sure, I might like to have a fancier WYSIWYG editor, but I’m not one to complain.

I say basically, because there are a few things missing. I quite dislike having to leave the comfort of my Eclipse development environment to do things like manipulate image files and what-not. Especially since most of the things that I do to image files is pretty simple: resize and crop.

I had a couple of hours to kill while sitting on an airplane (I believe that I write more software on airplanes than anywhere else), so I started developing a couple of handy plug-ins to suit my needs. The first plug-in is an image viewer: all it does is display the selected image. I hooked into the workbench’s selection service and listen for selection changes. If an image file is selected, the view displays it.


Here, it’s displaying one of the pictures I took during the Eclipse in Motion roadtrip while we were in San Diego. The view displays a scaled-down version of the image. If you hover the mouse over the image, it pops up a window showing the image in its full-size glory. The full size image goes away when you move the mouse off the image or click it (I discovered that moving the mouse off the image just doesn’t cut it when the image is larger than the screen). At some point, I may decide to add scroll bars, but I don’t need them today so that’ll be put off until some other time.

The next plug-in generates thumbnails (scaled down variants) of pictures. The first plug-in literally took me 20 minutes to build. The second one is taking longer for two reasons: (1) making a GIF thumbnail from a JPEG image (for example) requires that I somehow intelligently create an 8-bit palette; and (2) I’ve decided to build a wizard that steps the user through the various options for creating a thumbnail and I really hate laying out user interfaces. Number (1) may go away as I am very close to deciding that it’s okay for a thumbnail to just be the same format (and use the same palette) as the original. Alternatively, I’m assuming that this is a problem that’s been solved before and that with a little research there’s probably a solution out there that I can leverage. Number (2) is going to be helped along by the Visual Editor.

Of course in a vibrant community such as ours, there are plug-ins and products that do this sort of thing already (plus a whole lot more). For example, MyEclipse has image editing and preview capabilities built into it. QuickImage appears to be about as functional as what I created (and is apparently bundled with Yoxos and Exadel Studio). Then there’s “A Basic Image Viewer” on Eclipse Corner Articles (not a plug-in, but still interesting stuff).

I’ll make my plug-ins available to anybody who wants them. I’m about mid-way through setting up an “Evangelism” site on eclipse.org where I can put stuff like this. Watch this space for more information.

The Eclipse Tabbed Properties View

Monday, February 20th, 2006

Last night, I posted Anthony Hunter’s new “The Eclipse Tabbed Properties View” article on Eclipse Corner. In this article, Anthony describes the API for building (oddly enough) tabbed properties views. The article gives several examples of uses of tabbed properties, including the following (from the Eclipse GMF 1.0M4):

A tabbed properties view is pretty attractive when compared against the more traditional table-style properties view we’re all used to.

I hope you enjoy it.

How could I have forgotten about Stuttgart?

Thursday, February 16th, 2006

I blogged yesterday about BostonEDGE. But EDGE is not the first Eclipse group that I’ve heard of; there are others, including an Eclipse SIG that’s part of the Stuttgart Java User Group. They have regular meetings and invite great speakers including the foundation’s own Bjorn Freeman-Benson and other luminaries from the Eclipse community like Frank Gerhardt, and Boris Bokowski.

I’m going to speak there as well, just as soon as I can think of another good reason to go to Germany (one great reason isn’t enough to justify the cost of the trip; I need at least two). I’m really looking forward to the opportunity.

As Chris pointed out in comments to my blog yesterday, there is a new community-driven movement developing to spread the word about Eclipse. Oddly enough, it’s named SpreadEclipse (inspired by SpreadFireFox). The spreadeclipse.org website isn’t up yet, but it’s coming. Pay attention to this space. And… if you’re a believer, contribute!

EUG?

Wednesday, February 15th, 2006

It just occurred to me that one of the biggest inhibitors for folks getting together to talk about Eclipse has got to be the acronym. Who wants to go to an EUG (Eclipse Users Group)? It sounds a little like one of the grunts Tim Allen does in his stand up routine. Come to think of it, Tim Allen has made a pretty healthy career out of making grunting noises, so maybe EUG isn’t all that bad after all…

Anyway, I’m guessing that the good folks in Boston didn’t want to be grunting while talking about the great stuff they discussed the night before with their colleagues back at the office the next day, because they came up with a much cooler name. The Boston Eclipse Developers Group, or Boston EDGE has a very cool name. For me, the name immediately elicits the memory of Bono on the live Under a Blood Red Sky LP yelling “This is the Edge” (right before Edge screws up a guitar solo). In my books, anything that brings up memories that have anything to do with U2 is pretty cool. But I digress.

They’re pretty well organized and get some good speakers. Mike and I are talking with the organizers about getting down there ourselves to speak at some future date.

If you’re in Boston, you should check them out.

I know that there’s a few of you out there… if you know about an Eclipse group, please let us know. Especially if you need/want a speaker.

Eclipse in Motion: San Diego and Dallas Debrief

Tuesday, February 14th, 2006

We wrapped up the first leg of our Eclipse in Motion roadshow last week with stops in San Diego (Tuesday) and Dallas (Thursday). I had a great time and I’m pretty sure everybody who attended did. One thing that I’ve noticed about Eclipse events that are different from most other events in my history: folks tend to stick around for the entire event. In both cities, in all sessions, hardly anybody left early. Those who did leave early felt compelled to give us excuses. They were good excuses.

One of the cooler things about San Diego is the Midway aircraft carrier/floating museum in the harbour; clearly visible from the event hotel. While the aircraft carrier has almost nothing to do with Eclipse, I still think it’s really cool. Drooling over huge military hardware is a hobby of mine…

The seminar was pretty cool too. We had the same speaker line up for both San Diego and Dallas in the morning session. The day started with a bracing introduction by the Eclipse Foundation’s own Donald Smith. The real fun started with the invited speakers who included Carl Zetie from Forrester Research, Fima Katz from Exadel, Jonathan Baker from Sybase, Gary Cernosek from IBM, Brian Carroll from Serena, and Cliff Schmidt from Apache. Topics ranged from adopting Eclipse as an enterprise scale development environment, success stories, extending Eclipse in commercial products, contributing to Eclipse projects, and handling the legal issues faced in open source software development. Like I said before… nobody left early. It was riveting stuff.

I did manage to take a couple of pictures, but didn’t get anything really good. The lighting was pretty bad (for photography) in the seminar room. At least that’s my excuse and I’m sticking to it. I did take one of Cliff that’s pretty bad, but here it is anyway…
I ran the afternoon sessions. They were advertised as a code camp, but didn’t quite work out as we had planned. We advertised the afternoon session as a “roll up our sleaves and do some actual work session”. We even brough experienced Eclipse committers to work through issues. Alas, only a few who attended actually brought real Eclipse issues with them, so the afternoon turned into more of a technical seminar than a code camp. At the end of the day, everybody seemed pretty happy with what we did (which was to spend about four hours talking about Eclipse Rich Client Platform and WebTools). We managed to turn the sessions into pretty interactive discussions which was great. A few folks did manage to wrangle (being in Texas, it seems appropriate that there was some wrangling) some quality one-on-one time with the committers which is also great.

For those readers who have managed to keep up this far, I know what you’re thinking… What about the cookies? Well, the cookies in San Diego were great. Dallas… not so great.

The funniest thing that happened during the trip occurred on Thursday night in Dallas. We had a great meal at a great Mexican restaurant. About halfway through the meal, Donald started bouncing on his seat, giddy with excitement. A lot like a 10 year old girl with Hillary Duff tickets. Very excited.

We were all a little mesmerized by a camera crew jetting around the place. A little odd and a little out of place, we thought. But Donald was the first of us to spot the reason the cameras where there. He was muttering something to the effect of “it’s her” and “she’s here”. My first thought was that it must be Gina Gershon. It turns out that Rachel Ray was doing a piece on the restaurant for a show of hers on the Food Network. Donald’s a big fan. Anyway… he settled down a bit (just a bit) and then went and got a picture with her. Fortunately Chris had his camera with him. It’s a nice picture.

So for me, the first leg of the Eclipse in Motion seminars was a great success. I got a chance to talk with a bunch of interesting folks (and managed to convince a few of them to pursue RCP for their projects), got to hook up with some of my favourite committers, got to see an aircraft carrier up close and personal, and I got to see Donald giggle like a child. If only Megan Follows was at the restaurant. Then my life would be complete. There’s always Atlanta and Raleigh

Eclipse RCP Tutorials Updated

Tuesday, February 7th, 2006

Ed has updated his Eclipse RCP tutorial series to reflect changes in Eclipse 3.1.2. If you’re getting started with RCP, start here.

You are currently browsing the Eclipse hints, tips, and random musings weblog archives for February, 2006.

  • Pages

  • Archives

  • Categories