Skip to content

Archive

Category: Technology


Eclipse RCP by default promotes the usage of a single application window with multiple views and editors inside. This default can be changed to multi-windowed application. The platform API offers several methods to operate with multiple application windows:

package org.eclipse.ui;
...
public interface IWorkbench ...
{
/**
* Retrieves the number of opened windows
*/
public int getWorkbenchWindowCount();
/**
* Retrieves the array of opened windows
*/
public IWorkbenchWindow[] getWorkbenchWindows();
/**
* Openes a new window with given perspective
*/
public IWorkbenchWindow openWorkbenchWindow(String perspectiveId,
IAdaptable input) throws WorkbenchException;
/**
* Performs a perspective switch in a given window
*/
public IWorkbenchPage showPerspective(String perspectiveId,
IWorkbenchWindow window, IAdaptable input)
throws WorkbenchException;
...

}

Using this API, opening of new windows seems simple. For example one could define a perspective, that is always opens in a new window.

Closing windows is generally performed by calling close method on the IWorkbenchWindow instance.

package org.eclipse.ui;
...
public interface IWorkbenchWindow ...
{
  /**
   * Closes the window
   */
  public boolean close();
}

Unfortunaly, there is no elegant way to find out which window are you in. A workaround which uses Eclipse internal API works fine for WorkbenchWindow, which is a standard platform implementation of the IWorkbenchWindow interface.

/**
 * Determines if the window is a root window
 * @param window a window to be checked
 * @return true, if the window is considered to be a root window
 */
public static int getWindowId(IWorkbenchWindow window)
{
// HACK: note this could change in future
  if (window != null && window instanceof WorkbenchWindow))
  {
    return ((WorkbenchWindow)window).getNumber();
  }
  return -1;
}

The initial application window gets the id 1. The lookup in the implementation reveals that the internal method finds the smalles unused positive number and assigns it to the newly opened window. If you do not want to rely on this algorithm, just hash the newly created windows by they ids.

On October 15th to 17th the Workshop on MDSD Today 2008 took place in the Nordakademie Elmshorn near Hamburg. This workshop was actually the sequel to two different workshops which were led by Frank Zimmermann (Nordakademie) and Simon Zambrovski (TUHH) the year before. For this years event, Peter Friese (Itemis) from Itemis joined the two for organizing the Workshop.

MDSDToday

The workshop was divided into three parts: Day 1: Management Day, Day 2: Professional Day (Modeling Projects and Tutorials) and Day 3: Professional Day (Generator Tutorials). (See also MDSD08).

Ed MerksAxel UhlRalf Mueller

The first day was dominated by excellent key-note speeches given by the EMF lead Ed Merks Ph.D. and SAPs Dr. Axel Uhl. Ed was talking about misconceptions in understanding and applying model driven techniques. Axel on the other hand talked about the challenges that still lay on our way and need to be overcome. He discussed for example the different benefits and drawbacks of using different sorts of DSL (e.g. non-textual / textual) with respect to storing them in repositories, merging and refactoring (i.e. general tool-support). Birger Garbe and Stefan Reichert (both Lufthansa Systems consultants) talked about their experiences in applying MDSD in the field. Chances and riscs were explained and how they managed to overcome those riscs. Thomas Stahl of b+m Informatik gave a talk about how MDSD, BPM and SOA fit together, unfortunately he couldn’t give is planned speech “Experiences of 10 years of MDSD”. As one of the authors of the model-driven software development book and with the experience background he has, this would be have been clearly very interesting. The speech he gave instead was also interesting but took little different directions.

The second day was filled with two different tracks one could attend. One covered contributions coming from the fields of research and the industry. And in the other one Ed Merks gave an intro to the Eclipse Modeling Framework (EMF). After that, Ralf Möller of the Eclipse Foundation talked about innovation networks. The afternoon was filled with a tutorial on how to generate graphical editors using the GMF. The tutorial was given by Robert Wloch who jumped in for Jan Köhnlein (both itemis) who unfortunately got sick.

The third and last day was filled with a tutorial on xText, which was given by Peter Friese and Sven Efftinge (both itemis). Later Arno Haase (independant consultant) tought the audience how to do model-to-model and model-to-code transformations.

Nordakademie

Summing up this was a very, very interesting event where the cremé dé la cremé of MDSD gathered and where people had the chance to ask, learn and get to know each other. Not only the speeches and tutorials were very interesting, funny but the overall event had socially a nice friendly touch. Some further pictures can be found in the FlickR gallaery.

The Workshop Proceedings can be obtained at amazon:
Proceedings of the Second Workshop on MDSD Today 2008 (engl.)

Ed Merks new book will be published sometime in the beginning of 2009, here is a link to the “old” (but still good) one:

Eclipse Modeling Framework (engl.)

Also I would like to mention the book by Arno Haase, Markus Völter, Thomas Stahl, Sven Efftinge:

Modellgetriebene Softwareentwicklung ( english version)

OSGi HHOSGi HHOSGi HH

Yesterday, the OSGi session took place in Hotel East in Hamburg. Peter Kriens, the OSGi evangelist showed a wonderful Zen Presentation on OSGi. I wrote a lot during his talk which happens to me very seldom. Here are the core statements I understood:

  • The core difference between usual plugin architectures and OSGi is that OSGi concentrates on collaboration of the components.
  • OSGi delivers a controlled environment, in which the question if a component runs or not can be answered in beforehand.
  • OSGi bundles use metadata (about versions, dependencies, etc) to predict an error, not discover it in runtime.
  • OSGi has a very narrow API containing the minimal common part.
  • OSGi consists of module, life cycle and services layers. The initially developed services layer required smart class loading mechanisms (module layer).
  1. The module layer is desigend to control the class loading machanisms (e.G. structureal class loader hierarchies instead of a linear classpath)
  2. Life cycle layer adds a management API (e.G. inform the others about installation event)
  3. Separation of concerns is promoted by definition of services for different tasks.
  • Services are used for decoupling of system parts (This is a standard application of service-orientation).
  • OSGI makes dependencies explicit (private, import, export)
  • OSGI tries to make the system managable, taking dynamics and lifecycle as fisrst-class citizens
  • OSGI will be extended to support distribution: the team works on policies, SLAs, etc…

I liked the talk and the way how Peter Kriens addressed the problems of OO. I was confirmed in some ideas about coupling that will be layed out in my thesis. After the presentation we had a delicious meal and wraped up the evening with interesting discussion about pros and contras of OSGi. Peter Friese showed me some remote OSGi staff, he was playing with. The lack of documentation in this area makes it a little difficult, but I hope he will post some news on it. As usual, you can find other pictures in my FlickR gallery.

On Wednesday, August 27th I visited a presentation about Apache Maven 2. I will describe in short here what I have learned from that event and what you might want to know for your decision if you read more about Maven 2 or not. I will not repeat the basics or advanced features of Maven 2 here, it has been done a million times elsewhere. maven2-lifecycle

Maven 2 is often compared with Apache Ant. Sometimes it is seen as an extension to Ant. This is wrong. So, what’s the difference? Ant is a build tool, meaning you can build your projects with it. Maven is a “project management and comprehension tool”. Project management is actually focussing the technical part, is does not include Gantt diagrams or things like that. What is does include is a description of the technical part of your project, including a source repository, dependencies, documentation, developers and so on. What is the advantage of this?

  • Project setup is easier now. No searching for required libs, setting build paths, dealing with other weird stuff
  • Project comprehension is easier. The information about the project, the Project Object Model (POM) is human readable. That’s for a reason. Especially in larger projects this seems to be useful to me.
  • Changes in projects are tracked easier. Someone includes a new library? All the colleagues’ builds are broken. You have to communicate somehow to your team mates that they have to use that lib. With maven, just check in the new pom file, which includes the new dependency. All your colleagues will get it automatically from the repository you have in your company (hopefully).
  • Release management and integration in CI systems comes out-of-the-box. You have all you need to do that. Simply.

Granted, you can do a lot of those with Ant if you are good at it. But with Maven 2 it is a lot easier. As Maven 2 brings a standard project layout, projects not only look similar in their structure every time but they can build in support for a lot of things this way. The pom files are very short compared to Ant build scripts doing the same and more readable. Granted again, you can make your own Ant script containing standard targets you use in every project. You split your Ant files in project specific and general parts. Your project specific part is very short then. Then you did just what the creators of Maven did. Congratulations, you are a smart guy.

I am not saying that all your problems are solved by using it. Maven 2 has some weaknesses as far as I can tell from my limited experience with it. I heard from a participant that the automatic dependency resolving does not work all the time. Normally, Maven would resolve all transitive dependencies from all libs. If lib A is dependent on lib B and you include A in your project, the description of A includes the dependency. Maven will include B, too. I don’t know if that is a failure of maven or the guy who told me about it. AFAIK it needs time to get into it, I often encountered behaviour I didn’t expect. But that was because of my lack of understanding of Maven 2, not because of Maven 2 itself. So, the disadvantage is the same as with every new tool. You need time to learn doing stuff with it, and unfortunately you need to fail sometimes to learn from your mistakes.

BTW, Maven 2 is open source. Everyone who misses something or wants something to get better is welcomed to get into the dev team of Maven 2. One of  those points would be the beloved documentation which has great potential for improvement.

Hope this helps integrating Maven 2 into your understanding of the software development world.

EclipseThe vacation time of most people is over, so it is time to meet and discuss a little. A good opportunity to do this will be given on September 1st in Roxie, Hamburg during the Eclipse Stammtisch. The event name translates into regular’s table and indicates a regularity of the happening. Even if the upcoming event is only the second in series I expect to meet many people after the great feedback after the last one.

Details:

See you next Monday.

The Java User Group Hamburg (JUG-HH) organizes another event at Lehmanns Bookstore in Hamburg. This time the subject of the talk is build management and project automation with help of an open-source tool called Maven. Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

Subject: Maven 2
Date: Wednesday, 27-th August 2008
Time: 20:00
Who: Christian Matzat

On June 16th another Eclipse Demo Camp took place in Hamburg. Organized by Peter Friese of itemis and Martin Lippert of it-agile, Eclipse enthusiasts and presenters met in a former coffee exchange in the harbor of Hamburg, the so called “Hafencity”.

Eclipse Demo Camp

The evening started with an interesting preview of Xtext 2.0 by Sven Efftinge (also itemis). Xtext 2.0 is rewritten from scratch and provides better performance than its predecessor. The current plan for release is about October 2008. The talk was followed by a presentation given by Matthias Lübken (akquinet it-agile) who demostrated how to use the google web toolkit (GWT) in conjunction with serverside Equinox framework. Matthias talked about some of the tweaks which are necessary in order to get the two working together and also showed a little live demo. He was followed by Stefan Reichert of Lufthansa Systems who introduced his ‘wicked shell’ for Eclipse. This handy tool started as tech-demo how to bind an external process to a SWT widget. Finally, it turned into a command line, shell, bash… integration for Eclipse – featuring code completion and history. Reginald Stadlbauer (CEO froglogic) showed how to automize GUI testing of GWT and other Java based GUIs using froglogics Squish. Squish offers scripting languages like Perl, Python or JavaScript to the user to automatize application gui testing. The tool, not an Eclipse application itself, is currently rewritten and will feature full Eclipse integration sometime soon. Finally, Frank Zimmermann (Prof. at the Nordakademie) and two of his students Stefan Tanck and Henning Banneitz showed how model-driven software development (MDSD) using oAWs XText can be used to generate adapters for SAP SI in order to transform EDIFACT messages to XML and back. Unfortunately, a talk about Spring dynamic modules with OSGi was not held, the presenter Gerd Wütherich (independant consulting) was ill.

Apart from the interesting talks, it was nice to see many familiar faces, which attended the Eclipse Demo Camp in Hamburg at the end of 2007. The Eclipse Demo Camp seems to build a community. Thanks to the organizers for enabling this great event.