» tagged pages
» logout
Eclipse
Return to Euxx

How do you like your editors closed?

Tags Applied to this Entry

1 person has tagged this page:
Editor management is one of the tricky pieces of the IDE tools. When this task is left to the users, they usually end up with few dozens open editors and easily getting lost in switching back and forth between them. So, it is really helps when tool know when to close unused editors and there are several approaches to deal with that. Historically, Eclipse provided basic facilities for editor management and navigation.

There are few handy actions available from editor tabs, such as "Close", "Close All" and my favorite "Close Others". Then there is a traditional editor history in File menu and "Last Recently Used" editors popup that can be called with Ctrl-F6 (which I remapped to Ctrl-Tab for convenience) and good old "Switch to Editor" dialog (Ctrl-Shift-E) and its more lightweight variant with filter support (Ctrl-E). The latter two also allows to close editors using dialog controls or popup menu.

Most of the time those actions are used unconsciously, but it is still a lot of work to deal with all those editors when you are digging into something really huge or exploring some complicated API. To help with that, Eclipse introduced an option (quite some time ago) to close editors automatically, so you'll have reasonable number of opened editors. It can be configured at Window / Preferences... / General / Editors / Close editors automatically. Though it is still far from ideal...

Luckily, there are few other things you could use. Most recent invention is Autopin "tweaklet" from Eclipse UI team. The idea is basically that all editors are closed automatically. So, if you are browsing some code there will be just one editor open. However, if you made some changes, changed editor will be automatically pinned and will stay open. Seems nice, isn't it? Unfortunately, in practice there are few issues. First of all you can't jump back and forth between few editors anymore (i.e using Ctrl-F6) and "Go to previous editor" (Alt-Left) is somehow buggy with pinned editors. That bring us to the tool that been there for long time and next week will celebrate 2.0 release.

Yes, it is Mylar, and since recently, it can be installed from Europa update site. This tool monitors all interactions, and because of that it have much better idea which editors need to stay around and which one can be moved out of the scope. The current context state is also reflected in the IDE UI, so uninteresting elements are filtered out from the project structure, outline view and can even allow to automatically fold uninteresting sections in editors.

There is very simple UI that allow to unfilter context of views. There are toolbar buttons that allow to turn filtering off and for quick unfiltering you can use Alt-Click which will temporarily show full list of nodes for the filtered element. The UI is actually even more interactive. So, you can manually increase interest on certain elements (i.e. classes or methods) or decrease it, effectively removing those elements from the context (there is a popup menu for that, which also can be invoked with Ctrl-Alt-Shift-Down keyboard shortcut). Interestingly, when elements are removed from task context, corresponding editors are closed automatically and it work recursively for all nested elements (i.e. you can remove some project from context using keyboard shortcut or popup menu in the Package Explorer view and all editors for resources from that project will be closed automatically).

More over, task scope can be maintained in context of specific task and saved and restored when you switch from one task into another, quickly restoring task context. This stuff makes very easy to switch between tasks, but on top of that captured task context can be shared with other developers, which is very handy for code review and applying patches.

The opinions expressed in this post are my own and not necessarily reflect those of other Mylar developers or other Eclipse committers
Username:
Password:
(or Cancel)