tips Tag

Sometimes you have two collections and want to know how they differ. It would also be useful to have a series of steps that transform collection 'A' into collection 'B' (or the reverse). private static List list1 = Arrays.asList("a", "b", "c"); private static List list2 = Arrays.asList("a", "c", "d"); // Diff of list1 vs list2: // removed 'b' at 1 // added 'd' at 2 With a little help...

Read More

Whenever I'm working on UI stuff, something always goes terribly wrong ;-) Sometimes it's only a margin or padding, other times it a composite that crosses my path. I was pretty happy that Chris Aniszczyk and Simon Archer hacked together Picasso, which helps you to identify some of these layout issues. As you may know, most of the time I work on the Rich Ajax...

Read More

If you are into unit testing, you may find EasyMock quite useful. It is very valuable for making hard-to-test-code testable. For example I recently was adding tab-switching via keyboard to Riena. The state of each tab is kept in an interface named INavigationNode which has about 40 methods (!). Creating a mock by hand for such a big interface would not be fun at all. With...

Read More

Yesterday I spent the day working on examples of how PDE Build can be used to build OSGi bundles.  I was setting up builders, copying files from my workspace to my builder, and running builds.   Early in the morning I was faced with the follow: The method disposeImageButtonImages(ImageButton) from the type ScaledWidgetFactory refers to the missing type ImageButton Ok, a compile error, no big deal...

Read More

When adding keybindings to an existing Eclipse RCP application, it is extremelly helpful to get realtime information about which keybinding registered and to what command handlers it is mapped to. Why is that?  Because sometimes the operating system or another widget will consume the keyboard event before it gets to the command framework. Other times there are several handlers bound to the same key causing a...

Read More

Finally I had some time to write down some of my experiences with integrating the Business Intelligence Reporting Tools (BIRT) into a Rich Ajax Platform (RAP) application. I wrote it all down in a small tutorial that shows how you can integrate charts and reports seamlessly in your RAP application. Topics covered in the tutorial include how to setup the environment to let BIRT and...

Read More

Ever wanted to get a print out of all components that make up a piece of UI? This little recursive snippet does that for you. [code lang="java"] private void printChildren(Composite composite, int count) { StringBuilder spaces = new StringBuilder(count * 2); for (int i = 0; i < count * 2; i++) { spaces.append(' '); } for (Control c : composite.getChildren())...

Read More

For simple RCP Applications the Perspective-Switcher widget that ships with Eclipse is overloaded and cumbersome to use. We are going to get rid of it and replace it with an equivalent menu and/or toolbar for switching perspectives. Both should have an indicator to show which perspective is currently active. Hiding the Perspective-Switcher To hide the Perspective-Switcher we go to our ApplicationWorkbenchWindowAdvisor and instruct the IWorkbenchWindowConfigurer to not show...

Read More

Were you ever curious how to get those pretty colored labels in your JFace viewers you see all over Eclipse? For example, the blue counter label in the search results view: Well, I'll tell you how! Let's start with famous RCP Mail example: Let's look at the current label provider in the RCP Mail example: [code lang="java"] class ViewLabelProvider extends LabelProvider { public String getText(Object...

Read More

In the last blog entry regarding databinding, we learned how to create a custom observable for a DateTime widget. Starting with Eclipse 3.5 there is a new approach to creating custom observables as described by Matthew Hall in the comments to that post. Which ever way you choose, we will now use the observable to showcase another cool databinding feature: Crossvalidation. Crossvalidation was introduced with...

Read More