At work, Iím developing on a large internal application based on the Eclipse Rich Client Platform, which is basically the foundations of the Eclipse IDE made available for everyone else, too. As platforms go, itís alright, I guess, but it does have its share of weirdness. For example, why do I have to dispose colors once Iím done with them!?[^1](#) But with a healthy amount of helper functions, itís all manageable.
[^1](#): For compatibility with 8-bit indexed displays. Since this is nowhere near a target for our app, I generally donít dispose colors.
Weíve recently finished porting the application from Eclipse 3.7 to the 4.x line (specifically 4.5, planning to upgrade to 4.6 once itís out). This may seem a bit late, considering that the first official release of that line, Eclipse 4.2, came out four years ago. After working with the new code, though, Iím starting to think that maybe weíre still too early. Eclipse 4, or e4 for friends, features a massive rewrite of some of the core parts of the platform. And I think that itís unfinished and in parts rather misguided.
Editors are gone, as are views, replaced with generic parts. I could get behind that, but gone as well are editor inputs objects. So telling an editor what file to open and making that decision persistent requires custom logic - and possibly a lot of that if you relied on the flexibility editor inputs gave you. You might see the MInputPart in the documentation, but apparently that was never implemented and is now deprecated. I think the only reason itís still in the documentation is to taunt people. Of course, even if it did work, an URI based scheme only brings you so far if you have an editor that is supposed to receive objects from many different sources.
Many classic services have no e3 equivalent. For example, the IFocusService lingers around, but itís very unclear whether I can rely on it once weíre e4 only.
The documentation for new e4 specific stuff is largely missing or automatically generated and not helpful at all. I dare you to find any information in the documentation of MToolItem that isnít obvious from the method names. Whatís particularly missing is overview information: What do the different parts in the application model actually mean? Whatís the difference between a MPart and a MPartDescriptor, and which one do I need? Whatís the lifecycle of a MPart exactly? What is the point of context activation?
The best source of information are the rather terse Vogella tutorials, but these are task-oriented, not concept-oriented. If you want to do something that no Vogella employee wanted to do yet, youíre largely on your own.
Loose coupling. Like Spaghetti
I like the idea of dependency injection in theory, but Iím not sure about the practice. And I have no idea whether that is an Eclipse thing or not, but it still irks me.
The basic idea suffers from two problems: You want all dependencies passed in externally instead of getting them from some global nebulous set of singletons and what not. Thatís valid. But you also donít want gigantic constructors with 200+ arguments for complex classes. Not that you should have classes like that anyway, but a complex editor implementation can reasonably require access to most services Eclipse provides, even if it is just passes them on to helper objects.
The solution is more or less to put all that global state in a map, then pass that map as the argument to every constructor, and allow it to create new versions of the same map internally. Only they chose a more complex version that also has a lot of syntactic sugar, to make sure it runs really slowly. Eclipse has a reputation to maintain, after all.
As a result, you still have no clear idea what part of the application needs access to what unless you search for type names, and now you also have no idea where itís coming from. Itís not so much that itís bad per se, but it definitely does not realize the advantages that dependency injection was meant to provide.
And while weíre here already: The way event handling is done via dependency injection is just insane.
Horribly bad ideas
I honestly donít get the application model, and not just because there is no real documentation on it. I have no idea why itís here at all, what problems itís meant to solve, and how it thinks it has solved them. And most of all, I donít get why so many Eclipse developers are so damn happy about it. “Look at this”, they go, “I change the windowís title in the application model, and the windowís title actually changes! And I can even do thatÖ at runtime!” And then theyíre surprised when I donít applaud.
But hey, whatever, Iíve been able to write helper methods and helper classes to get around any problem in e4 yet. The real problem of the application model is that it seamlessly merges user state and declarative application code into one giant ball of mud. And then it makes that mud persistent, which is just as unpleasant as it sounds.
Because suddenly, changes in user state get the opportunity to conflict with changes to declarative application code. Will my new context menu show up if the user has moved any editors around? For that matter, will my old context menu continue to show up? Surprisingly often, the answer is no, and never for any good reason I could discern. By merging what absolutely had to stay separate, they built a giant bug-producing machine.
And they know it. The closest thing to an official recommendation is to simply disable persistent user state. Only during development, in theory, but they sure donít provide a better way to deal with the problem once I release an update of my app. In my opinion, this wins the very highly contested price for least user-friendly thing ever done in Eclipse.
Oh, thereís a workaround, but itís one that nobody will tell you about, and itís the most WTFy thing I ever implemented, to the point that I still canít quite believe that this is what it takes. But Iím doing it anyway: I wrote my own code for serializing the application model to an XML file and back, making 100% sure that I only touch the parts that the user can change (i.e. what editor is where), but not the parts that are declarative program code. Itís been a few months since I implemented this thing, and I still sometimes wake up in the night and shout “There must be something better! Some simple flag I missed somewhere!” Do drop me a line if you found it.
Finally, command handlers. The new way of writing them is good. Having the validation logic in the handler itself as opposed to an XML file somewhere is better. Good choices all around.
Less good: Why can I have only one handler per command per part? I kind of need several different “delete” handlers for different parts of some more complex editors, thank you very much, and I have only limited interest in creating one giant monster handler that contains the delete logic for absolutely everything. Of course itís possible to work around that; Iíve managed to work around every little thing in e4 except the application model weirdness so far. In this case, write one handler that creates an internal list of other handlers, then asks each whether it can execute and the first one to shout yes gets to do the job. But I donít get the logic that says I have to write stuff like that.
I also donít quite get why some handlers exist and others donít, but thatís less of an issue.
No tool support
Why is it that so many new things are released without good tool support? Do people somehow think thatís optional? I donít see it. For example, to port from e3 to e4, there is an awful lot of getting information out of one XML file, translating it, and putting it into a different XML file. Itís boring, tedious and straightforward. And the one and only tool I found for that is one I wrote myself (No; you canít have it. Nothing personal, but I have no idea what hoops Iíd have to jump through to get something developed internally released as Open Source here).
The tools that do exist regularly stop accepting copy and paste and have no useful search. Most of them arenít part of the platform proper, but require a separate download. It all feels very experimental. I went back to editing the XML files by hand.
Overall, e4 is still very far from done, and thatís frustrating. But in a few places, even the core is wrong or at least questionable. And while it looks like Eclipse 4.6 will solve a few issues Iíve been having (Generics for Databindings! Hooray!), they donít seem even interested in solving the big ones.