the corner office

a blog, by Colin Pretorius

Views and editors

JFace encapsulates the underlying SWT toolkit and makes it a lot easier to do certain things. It has its niggles, though. I'm back to fiddling around with two small Eclipse apps, and in both cases the apps use views and editors. Views and editors in Eclipse parlance are sorta kinda conceptually what their names suggest, and are basically 'windows' within a workbench (and actually derive from the same parent class). Editors just have slightly different functionality, including inter alia the notion of being 'saved' or 'unsaved'.

Only problem is, it doesn't seem like you can mix these two types of windows up. You can have areas for views, and they'll stack up in tabbed fashion, and you can have an editor area on your workbench, where all the open editors will stack up in tabs, but never the twain shall meet. I'm not sure if I'm just missing something, but some googling suggested that others have had the same issue, and I'll be buggered if I can find a single example of where both are combined in the same area.

This makes sense for an IDE, where you generally want part of your screen to show a 'view', which is usually a list or tree, and then be able to see your editors at the same time. For views in other applications, screen real estate can be more of an issue. I'm quite partial to the old Lotus Notes way of doing things, where views and editors are all mixed up as separate tabbed windows. I wondered how it was being done in Notes 8, which is basically a big fat Eclipse app, and found a blog entry by one of the Notes developers at IBM who mentioned that all Notes windows are views, not editors. Counter-intuitive it may be, but it's perfectly possible to implement an editor (with normal form controls) as an Eclipse view. You just have to work around not having the special 'editor' features that JFace provides.

I guess that's the only way to do it, but I'd be curious to know whether the clear separation of editors and views is an explicit design decision, and if so why it was taken, or whether it is, as I suspect, just a hangover from Eclipse's IDE heritage.

{2007.06.04 23:17}

« Fuxits

» Famous