Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Thursday, January 15, 2009

Validating Archive Contents With Ant

Have you ever wanted a quick way of validating the contents of an archive as part of your Ant build? I'm sure there are many ways to accomplish this, the most straightforward being to inflate it to a temporary directory, but yesterday I crafted up this little nugget to validate an archive in-place and it seems to work great. And the best part is there's no messy cleanup needed afterwards!


<!-- Compute the difference of the actual JAR and the expected zip entries -->
<resources id="artifact.set.discrepancies">
<difference>
<!-- Create a resource set from the actual archive -->
<zipfileset src="${path.to}/some_archive.jar" includes="**/*" />
<!-- Create a resource set of expected items -->
<resources>
<zipentry archive="${path.to}/some_archive.jar" name="afile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="anotherfile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="a/path/to/afile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="some/other/path/to/afile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="META-INF/MANIFEST.MF"/>
</resources>
</difference>
</resources>
<pathconvert property="set.difference" refid="artifact.set.discrepancies" />
<condition property="artifacts.verified">
<resourcecount count="0" when="eq" refid="artifact.set.discrepancies" />
</condition>
<!-- Fail if any differences are found -->
<fail unless="artifacts.verified"
message="The following artifacts were not expected: ${set.difference}" />


Note: I believe a minimum version of Ant 1.7 is required for the resources stuff to work.

Wednesday, September 10, 2008

Ant Wizardry

I've been spending a lot of time messing around with builds lately and that means reacquainting myself with my old friend, Ant. Back in the old days, I always wished there was an easy way to do simple string replacement/concatenation, creating a new property as a result. Sure you could use the antcontrib tasks, but I usually did not have access to them when it really counted and it was one more dependency to worry about. The other option is to mess with temporary files or some other naughty-feeling hackery (I think I used pathconvert once to do something like this and felt really dirty about it).

Anyway, as of Ant 1.7, check out what is possible. Run the following build file:


<project name="test" default="test">

<target name="test">

<loadresource property="abc">
<string value="One two three four" />
</loadresource>
<echo message="abc=${abc}" />

<loadproperties>
<string value="one=two${line.separator}three=four"/>
</loadproperties>
<echo message="one=${one}" />
<echo message="three=${three}" />

<loadresource property="test">
<string value="${one} two ${three} four" />
</loadresource>
<echo message="test=${test}" />

<loadresource property="test2">
<string value="${test}" />
<filterchain>
<replaceregex pattern="f(ou)r"
replace="f\1l"
flags="g"/>
</filterchain>
</loadresource>
<echo message="test2=${test2}" />

</target>

</project>


And you will see this output:


C:\testing\>ant -f testbuild.xml
Buildfile: testbuild.xml

test:
[echo] abc=One two three four
[echo] one=two
[echo] three=four
[echo] test=two two four four
[echo] test2=two two foul foul

BUILD SUCCESSFUL
Total time: 0 seconds


I wish I had this in my back pocket about four years ago...

Monday, September 1, 2008

Mandatory Software

As Doug has already mentioned, an interesting product from Google is being released tomorrow: Google Chrome. I guess the rumors were true after all! Since I have recently re-formatted my computer and I am currently in the midst of re-installing all of my applications, their timing is relatively good.

I discovered something interesting while re-installing software on my PC. After re-ghosting my machine (and installing various hardware drivers, Windows XP Service Pack 3, and a large number of updates), I installed the following software first:


So Eclipse wasn't the first thing I installed, but it was quite near the top; and Vuse uses SWT under the covers so that's a pretty good showing for Eclipse-sponsored software in my little world. Also keep in mind this is my home PC, not my work laptop - so this list is not particularly tailored to full-on software development (hence the Steam install). I'll have to do another list when my work computer gets reincarnated. ;o)

I remember the Python blogging community chipping in about what programs they use daily (and would install first on a new machine) and it was quite interesting. I wonder what other people's short list might look like?

Wednesday, June 25, 2008

Choo! Choo! (chug chug?)

I am mid-way through getting my Ganymede packages and suddenly Eclipse.org seems to have standardized on the Mozilla templates. ;o)

It's pretty spotty but as long as I can get through to my super-fast, local mirror I can enjoy 1-2MB/s download speeds. It's just getting through to the mirror that seems to be the problem. C'mon, just one more zipfile to go! I think I can...I think I can...

Update: Downloads complete! Next step: Profit.

Tuesday, June 24, 2008

Next Stop: 3.4

Tomorrow (today at this point...is it really that late..err..early?) is the official release of Eclipse 3.4 (Ganymede), and for us it marks that special time of year where we ship another major release of our commercial product* freshly minted to work with the latest version of Eclipse. We typically start integrating with the latest Eclipse development milestones around M6 or so, and file as many bugs as possible as we find them in the hopes of getting them addressed before June when the train ultimately leaves the station. Looking back, the move from Eclipse 2.x to Eclipse 3.0 involved a little pain, but subsequent releases have all gone relatively smoothly. There was also that little hiccup when the Debug Team introduced flexible hierarchy, but that was for the greater good (and the Debug Team is always so helpful!) so all was well in the end.

This year's minor wrinkle is moving to P2. There has been a lot said about P2, both positive and negative, but I think ultimately it is a good thing. I have been struggling with it quite a bit over the last week or two mostly due to the fact that we simply have not had time to pick apart P2 and figure out what it is all about. The bottom line is we did not budget any time to port our installer over to P2 or to make our features fully P2 compatible (so much so that I really don't even have a full grasp of what "fully P2 compatible" means yet), but I think once this release is out the door and we have time to suck in a lungful of air, we can enjoy the sunshine and move forward into that brave new world.

I was hoping to have some time to write up a little review about Ganymede, and that task is still percolating in the back of my head. I also have a 2.5GB AVI sitting on my hard drive that I have been meaning to finish turning into a screencast one of these days and I was also intending on finding the time to convert my EclipseCON presentation into a more useful article. Hmmm... Perhaps this summer will afford me a little more time to work on Eclipse-related stuff provided I don't get distracted by winning bread and life in general.

*NOTE: You have to visit this link twice if you are interested as the first time you are redirected to an acquisition info page and some sort of cookie is set to indicate that you have been "informed". Not my design - sorry.

Thursday, March 20, 2008

Presentation and Source Code Uploaded

The presentation for my talk on extension points has finally appeared on the EclipseCON website for those of you who wanted it. There are a TON of notes in there that are quite useful (I think), so it is worth downloading the source .ppt file for reference.

I also uploaded a zip containing the source code for my demo plug-ins for those of you who were interested as well. It seems the Cloudsmith SVN server is down, so I figured I would just upload them as an attachment to my presentation summary along with the presentation. But judging from how long it took the presentation to appear, it may be a few hours before it shows up. This code is completely unsupported, but shoot me an email (mark dot melvin at gmail dot com) if you run into issues. I tested it on Linux, Windows XP, and Vista, but did not test it on a Mac (let me know if it works or doesn't work if you have a Mac).

Thanks to everyone who attended!

Update: I am not sure the code is ever going to appear as a link on the main talk summary page, but you can always go to the Eclipsezilla submission page and download the attachment here:
https://eclipsecon.greenmeetingsystems.com/submissions/view/388

Wednesday, March 19, 2008

EclipseCON Updates

Tonight I decided to bail early on the Poster Reception and nip over to the Faultline Brewery for a quick steak and a pint of stout. They have free wireless so I am actually enjoying a pint waiting for my steak as I type this. I remember coming here a few years ago for an earlier EclipseCON and it was great.

After dinner I'll head back and catch a couple BoFs. Then I have a bit more work to do to prepare for my long talk tomorrow. And I still have not had a chance to hack out a BUG app! It is going to be another late night.

Oh, and the stout is quite nice...

Update: The steak was awesome too!

Monday, March 17, 2008

Lots Going On

Well, there is a lot going on both here at EclipseCon and back home. I now work for a new company (again)! It wasn't entirely a surprise, but it just became official today. I ended up making two versions of everything in anticipation of this acquisition and I even brought along a sticker to "modify" my EclipseCon badge. So now I can finally upload my presentations and sample code under the new company name. I know what I'll be doing tonight...

EclipseCon seems to be starting out alright. I'm a little tired, but I finally got a chance to grab a coffee (I was in line for registration and missed breakfast and coffee this morning!) and life is better now. I sat in on a couple OSGi tutorials that were interesting. Now it's time to see what this year's lunch spread is like!

Sleepless In Santa Clara

So I just got to my room and I *just* got wired internet connected so I can check tomorrow's (today's) schedule. My flight was delayed and it took me about 13 hours door-to-door to get here from Toronto. That has to be one of my worst journeys yet. And now, there is nothing open here except McDonalds and Jack In The Box, so I just had a quarter pounder and fries for dinner (it is 4:30am my time). Yummy!

And to top it all off I can't get the Hyatt's wireless to work. I can connect to the tmobile access point, and I can even browse t-mobile.com. But no other address resolves, and it doesn't prompt me to sign up (which is what is supposed to happen). The people at the front desk are clueless so they gave me T-Mobile's tech support number. Well after explaining the problem all over again and waiting 30 minutes on hold for a *real* tech support person, I gave up and just plugged in the damn LAN cable. We're not off to a good start. The only good thing about today was my rental car was upgraded to an Audi A6.

Here's to a few hours sleep and hoping tomorrow is a better day!

Friday, March 14, 2008

Spaces Rocks

So my last post came off a tad negative (that'll teach me to post when frustrated), but the email I got from the EclipseCon bot asked me to give the team some feedback by trying it out - "it" being Spaces. Well, I did that and I was frustrated by the initial overhead.

But I guess I should focus on Spaces - the Eclipse technology - and not AOL's sign-up process. And from what I see so far, once you get past setting up the XDrive account it looks pretty cool. So please, don't be put off by my initial experience. Try it out for yourselves.

So How Can *I* Use Spaces?

So I got an EclipseCon email telling me I should share my code using this nifty new thing called Spaces. And to be honest - I'd love to use it. But is it just me, or it is only possible to use this service via AOL XDrive? First of all, I have never heard of this service (I mean, who uses AOL outside of the US?), but OK, fine - I figured I'd give it a go.

Well, I tried to set up an account and they only accept US zip codes. What's a poor Canadian supposed to do? Make up a US zip code, and fake phone number. Check. Well, after 5 more minutes and about 10 tries at trying to figure out why it won't accept my username, or password, or captcha input (I'm still not sure which is wrong - it seems to be telling me the captcha is wrong, but it looks right to me...) I'm giving up in disgust. Their website totally sucks. There is no way to check the username availability without typing everything in and seeing if it fails (forcing you to type it all in again), and I can't seem to type in correct information no matter what I do.

So - I *really* want to use the Spaces feature. Honestly I do. But why is it tied to AOL XDrive? Surely there has got to be a better service than this?? What about hooking into something like Google Code or Sourceforge? Henrik's blog suggests there may be Sourceforge support but I don't see it anywhere in my installed version. Am I missing something here? I'm about to just throw it onto my Linux server at home, but it certainly won't stand up to more than a few people downloading at once (although that's probably all I need anyway...).

But wait! I just read Henrik's next post about using bluestring.com instead, along with a fake ZipCode and it worked (after jumping through way too many hoops)! OK, so now I have an XDrive account and AOL or bluestring.com has a lot of information about me (most of it fake). Hmm...this had better be worth it.

Is there anyone else out there using Spaces? It looks like a great idea, but currently seems to be crippled by a crappy back-end. Maybe the Eclipse Foundation should consider providing some storage space for Eclipse-related projects? Either that, or the Spaces project should start supporting other backends very quickly. I'm a fairly patient guy when it comes to this sort of thing (I sign up for a lot of crap), so I can see the majority of people quitting after the first sign-up screen.

Sunday, March 9, 2008

Looking Forward To EclipseCON

While I am still cranking on polishing up my presentations for EclipseCON (is it March 9th already!?), I am definitely looking forward to a week in sunn(ier-than-here) Santa Clara. Especially after the massive dumping of snow we got this weekend.





And to think, I was BBQ'ing steak a couple weeks ago...

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):

/**
*@Override
*/
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;
}

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.

Wednesday, January 9, 2008

Hello World!


Hello, everyone! If all goes well this post should get automatically sucked up and spat back out squarely in front of billions and billions of people by that terraforming umilator that is Planet Eclipse. OK, maybe not that many, but I'm still worried about spelling and grammar.

I just wanted to post a quick introduction as well as a shameless plug for my talks at EclipseCON this year. I'll be presenting a short talk entitled From The Horse's Mouth - What Embedded Developers Like and Dislike About Eclipse-Based Development Tools, as well as the long talk Creating Your Own Extension Points: It's Easier Than You Think!.
(Why am I suddenly reminded of a certain Simpsons character?)

"Hi! I'm Mark Melvin! You may remember me from such presentations as Language Toolkits, 10 Tough Decisions You Must Make When Developing An Eclipse-based IDE, and Who are these people on stage and what makes them so qualified to talk about this topic?"

Unfortunately I could not make it to last year's conference (I've been to every other one) so I am really looking forward to attending this year! It looks like there are many interesting talks to choose from, and I'm sure it is going to be harder than ever to fit in all the ones I want to attend. Over the next few weeks I'll be trying to shape up the final abstracts and material on the website for my presentations, and hopefully I will end up with something people will find both interesting and useful. Oh, and I went ahead and changed this into a BoF. ;)

In the meantime I'll try to post here every now and again about Eclipse as well.