Monthly Archives: January 2009

SWTbot: Automatic GUI Testing for RCP/SWT/Eclipse Programs

I finally sat down and spent two hours on using SWTbot. It is a automatic GUI testing tool for RCP/SWT programs. If you are writing AWT/Swing programs, it’s not for you. For AWT/Swing, you may want abbot.

I experienced several problems with setting it up. Finally I installed SWTbot 1.2, configured the launch settings,  eliminated a NullPointerException error, and finally got it running. Feeling pretty good now.

SWTbot is being proposed to become an eclipse subproject. The latest version is 2.0. However, you might want to try 1.2 before getting more familiar.

Some Links for Domain Specific Languages

I am looking into DSL (domain specific language) recently. There are a few links below, bookmarked for my own convenience:

  1. Language Oriented Programming: The Next Programming Paradigm
    A good paper introduction to DSL. The language is plain, vivid, and easy to understand. Really a good start point.
  2. An introductory example of domain specific languages – by Martin Fowler
    It’s a very good start point. Martin gives explanations by examples, which make everything clear to understand. There are some examples in XML, ruby-like, and vbscript-like forms.
  3. The Pragmatic Code Generator Programmer by Sven Efftinge et. al.
    Another article for using openArchitectWare Xtext.
  4. The Help Documentation coming along with the Xtext Framework
    Definitely the good documentation to start with Xtext.
  5. Sven Efftinge’s Blog
    Svem plays an important role in developing Xtext, which is a DSL framework.
  6. More blogs ……
    More blogs at ohloh……
  7. The Xtext Framework: TMF Xtext and oAW Xtext
    The former is a subproject of eclipse TMF (textual modeling project). The latter is under the umbrella of OpenArchitectAWare. Definitely there is connection between them. Yes, by the same group of people.
  8. MPS Project – Developed by a famous European company, they published the paper of the #1 item.

Encoding Problem with HttpClient

HttpClient looks very nice, as it supports many HTTP actions. I tried the webpage download code, but encountered an encoding issues with Chinese web pages.

Language encoding is always a problem for non-English developers, especially Asian developers, whose languages are encoded in 2 bytes for each character.

After playing with the source code for hours, I finally googled a very simple solution. Here it comes:

Though spent hours, I am very glad that the solution is very simple.

Writing an XML Editor using JFace Text Framework

I am trying to write an XML Editor using JFace Text Framework. I started from the default XML Editor template created by eclipse. The editor is much more powerful than the very beginning. What I have finished during the weekend are:

  • Document Partitioning
    • Add CDATA scanner
    • Configured SourceViewConfiguration
    • Modified TagRule and a couple of classes
  • Syntax Coloring
    • Mimicked the color theme in XMLSpy, but added more colors
    • Merged some functions. Therefore a couple of classes are of no use now. Will clean them later.

I wish to add the following features:

  1. XML validation
  2. Error marker
  3. Content Assist
  4. Proposal for errors
  5. Define extension points for easy customization

I have created a project at google code. But right now it is not the timing to paste the link here. I might release it in the future.

If you are looking for reference materials about writing an editor, I recommend the following staff:

  1. Building an Eclipse Text Editor with JFace Text
    http://www.realsolve.co.uk/site/tech/jface-text.php
  2. Rinzo – Open Source XML Editor
    http://editorxml.sourceforge.net/features.html
  3. Java Developer’s Guide to Eclipse, download the CD-ROM content and find the SQL Editor sample:
    http://www.jdg2e.com/
  4. Eclipse Web Tools Platform (WTP) has an XML Editor:
    http://download.eclipse.org/webtools/downloads/
  5. HTML Editor also contains an XML editor:
    http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor