3

Is there an Eclipse shortcut to switch between multiple text editor configurations?

When using Eclipse, I typically have two editor tab configurations:

  1. Side-by-side configuration. I keep the main class file on the left and the corresponding unit tests on the right.
  2. Single-tab configuration. I view only one class file at a time in the editor.

I use #1 when at work, when my larger monitor allows me to see 100-column files side-by-side without horizontally scrolling.

I use #2 on my laptop when in transit (bus, plane, etc). My laptop is not wide enough to support side-by-side, so I only display one file at a time to avoid horizontally scrolling.

What I would really like is a way to switch configurations quickly. I often leave work with tons of tabs open in my workspace, which is very difficult to read when I open it on my laptop.

NOTE: Perspectives don't appear to solve this problem, since Editor configuration is constant across all perspectives.

1 Answer 1

0

Your problem is that editors are not bound to perspectives like views are. Perspectives are collections of views, and optionally, a viewable editor area. However, which editor(s) are open at any time is something that's under the control of the workbench, and not the perspectives.

Nevertheless, a solution for your problem is discussed in the article
Show / Hide Eclipse RCP Editors depending on the current Perspective.

The article is too long to reproduce here, but the steps it describes are:

  1. Implement an Editors Tracker.
  2. Implement a Perspective Listener, which will listen for perspective changed events and will show or hide the editors accordingly.
  3. Subscribe the listener to the workbench.
2
  • Thanks for the comment. Seems like a lot of work. For now, I'm just closing all windows (ctrl+shift+w) when I start a laptop session and just open the Resources I care about manually. Aug 6, 2013 at 20:02
  • A lot of work because your demand wasn't foreseen for some unknown reason by the developers, so you have to extend the workbench yourself.
    – harrymc
    Aug 7, 2013 at 5:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .