At work, I am enhancing an Eclipse RCP application now. I thought it is a good opportunity to see what I have been missing by mainly programming in Swing. About three weeks into the project, I can say that it was in fact pretty easy to understand at the beginning. The layout management cost me a little while to understand. I also had get to used to the fact that a lot of constants are defined in the SWT.* manner (SWT.LEFT, SWT.BORDER, SWT.V_SCROLL,…). I just don’t see any logical relationship between those constants other than that they belong to SWT. Well however, probably it is easier that way for most people (not having to remember the logical context), at least it is somehow C(++)-ish.
I consider myself a pragmatist, so if a tool does the job, I don’t think too much about it. I like Eclipse’s architecture, how Eclipse plugins are written and how this process is supported by pretty good tools. However, I still can’t see the advantage of RCP/SWT. I get OutOfMemoryErrors every day, which takes down not only my application, but the whole Eclipse IDE (kind of reminds me of the times when applications took down the whole operating system), I can hardly remember this kind of thing happening to me using Swing other than programming a non-terminating loop (this does not happen too often). Another annoying thing is that exceptions thrown in my plugins seem to be swallowed somewhere in the platform.
I found a comment on the Eclipse news board here:
I'm curious as to why the workbench is catching and (apparently) ignoring exceptions that are causing my plug-in to be unable to successfully create pages in a multi-page editor. Seeing the exception and stack trace would be extremely helpful in diagnosing the problem, but for some reason the exception is being silently ignored.
and the answer to this is:
As far as I know, exceptions are logged to your target runtime workspace's .metadata/.log file. To see stuff in your console, you want to add -consoleLog as a 'Program Argument' in the 'Arguments' tab of your PDE launch configuration.
The biggest issue besides those OutOfMemoryErrors I have with RCP/Swing is flexibility. Example: at the moment (Eclipse 3.2), TableViewers allow cell editors to be defined by column and not by row, which is pretty limiting in our case, where the users are used to spreadsheet-like interfaces. I should point out that this issue seems to have been addressed in 3.3. Another question is: Why in the world do I have to create a specific version for Windows one for Linux, one for Solaris etc. I really feel like I am back to C/C++ here (especially with those OutOfMemoryErrors 🙂 – I know I am stressing it here).
Probably I am just expecting too much. Because everywhere I can read how much cooler/easier (have your favorite buzzword here) SWT/RCP is compared to Swing, I thought it must be somehow on the same level. As any developer, I’d be happy to use whatever does the job and gets it done quicker, since I don’t work for Sun or IBM, I have no cultural pressure here, either.
RCP/SWT works ok when I want to create an “Eclipse Workbench”-ish user interface (which I often don’t). At this point, I can’t really understand the hype surrounding it, especially those quotes made by people who claim to have been experienced Swing developers and converted. I don’t see how that is easier, or more powerful, but in my opinion, it contributed to creating a lot of FUD about Swing, client sofware development in Java and Java in general. Java is a fantastic platform to create client applications, just no one seems to see it and just talk about how complicated user interface programming is in Java. This is because user interface programming in general is a hard task. Just placing a few buttons here and some icons there doesn’t make a good interface.
I know that there will substantial improvements to the Eclipse RCP framework since there is a huge interest and investment in it (even though I could have lived without this reinvented wheel in this case) and if the project calls for it, I will use it. But for now I have to ask: Where’s the benefit ?