Twitter github

Posts Tagged with “swt”

SWTBot and Eclipse Forms

When it comes to user interface testing in Eclipse, I’m a big fan of SWTBot. I had some long plane rides recently and a need to add some functionality to SWTBot so I decided to see if I could tackle an outstanding feature request in SWTBot to add Eclipse Forms support. On top of that, I also had a selfish reason to learn more about the internals of SWTBot. After forking Ketan’s copy of SWTBot on GitHub, I pushed my changes which adds an SWTFormsBot class as the primary handle to drive user interface tests.

So your test code would look something like this…

public class SWTBotImageHyperlinkTest extends AbstractSWTBotFormsTestCase {
 
	@Test
	public void findImageHyperlink() throws Exception {
                FormView view = new FormView(shell);
                SWTFormsBot = new SWTFormsBot();
		SWTBotImageHyperlink link = 
                     bot.imageHyperlink("Image link with no image");
		assertNotNull(link);
		assertEquals("Image link with no image", link.getText());
	}
 
}

We’re looking to eventually integrate this into SWTBot proper, just pay attention to this bug if you’re interested.

Enjoy.

SWT Tidbits

I saw some interesting SWT related things as of late so I figure I’d share with everyone.

STW – SWT Transition Widget

It’s a widget that enables transition effects in SWT… see for yourself…

I think the project is a good candidate for Nebula if anyone wants to reach out to them.

Nebula – AeroToolBar

It looks like the Nebula project will be getting a donated widget that resembles the Vista toolbar.

SWT UI Mockups

I generally find user interface wireframing tools very lackluster. However, taking an existing piece of live user interface…

And painlessly turning it into a mockup

Very cool!

Anyone see anything else good lately?

I want my HelloWorld

Sometimes during my “Eclipse newsgroup altruism time,” I stumble upon things that make it worth it:

JFace Databinding is Cool

I have been getting to know JFace Databinding lately. It was on my TODO list of Eclipse technologies to learn and although things were rough in the beginning, I’m starting really appreciate things. For example, I had a use case where I was binding a value to a text control. By default, the model was being updated on every keystroke which could be fine. However, if you have a complex UI that does fancy validation, it can cause unexpected results like refreshes that you just don’t want. A simple and more natural thing is only to commit a change to the model after the user is done typing instead of every keystroke. The solution in JFace Databinding is simple…

SWTObservables.observeDelayedValue(400, myObservable)

There’s also a nice code snippet that you can run to see how the code works.

carb0wn3d

So let me tell you a story about my new Macbook Pro and J2SE6. I was working with an application that required J2SE6 and when I was ready to do some self-hosting, I was greeted with this:

My first impression was like… oh no, what a newbie I am… I forgot about the carbon and 64-bit JVM issue. The only funny thing I got out of it was a new word for my lexicon to describe my situation: ‘carb0wn3d’ (credit to Kevin Barnes of the SWT team ;p).

However, never fear, there are good ways to deal with this issue for now. At least in my case, I have cases where I need to do development and test on multiple platforms anyway. VMWare Fusion allows me to do this very well and it even integrates well into my desktop:

Cool huh? Easy multi-platform testing for me now 😉

Anyone have better suggestions besides waiting or hacking on the SWT Cocoa port 🙂

SWT / Qt?

I just noticed this post on the newsgroup. It seems EPL 1.0 is now included as an exception for Qt. IANAL, but does that mean it’s possible to do some SWT / Qt love without fearing the wrath of lawyers?

Eclipse and OLE

If you ever wanted to learn how to integrate things like Microsoft Excel in your Eclipse RCP applications, Lars Vogel has an article out there with some nice and easy to understand examples.

SWT Ribbon

Since not everyone in the world browses the Nebula newsgroups, I figure I would point people to some interesting work being done by Emil Crumhorn (a newly minted Nebula committer). Pictures speak louder than words for me on this kind of stuff:

Resizing Images using SWT

I was toying with ECF today along with those new fancy custom tooltips.

In the process of doing this, I was dealing with images obtained from google’s GTalk server and they were coming back in crazy shapes and sizes. I thought to myself, it can’t be that hard to resize images, lo’ and behold… it really isn’t… here’s a code snippet to do it (may not be the best way, but it works):


private Image resize(Image image, int width, int height) {
Image scaled = new Image(Display.getDefault(), width, height);
GC gc = new GC(scaled);
gc.setAntialias(SWT.ON);
gc.setInterpolation(SWT.HIGH);
gc.drawImage(image, 0, 0,
image.getBounds().width, image.getBounds().height,
0, 0, width, height);
gc.dispose();
image.dispose(); // don't forget about me!
return scaled;
}

Now all I need to figure out is how to make those new fancy custom tooltips even better. I have a usecase where I want a user to click that tooltip, if so, leave the tooltip open and allow the user to click possible hyperlinks and close it manually later on. The reason I want to do this is because I want to allow people like the Mylyn folks maybe to plug something in where they could have a hyperlink to show relevant tasks on a user.

GANTT-tastic

Since I’m having a bad day (can’t find my beloved BlackBerry in Austin), I figure I would spread some love to the Eclipse community. It looks like there will be some new widgets coming into the Nebula project soon (after they pass IP review of course, thank you Emil!). My favorite of the three new widgets is the Gantt one 🙂