Home » Eclipse Projects » Eclipse Platform » IWorkbenchPage.getEditorReferences vs. tab order
IWorkbenchPage.getEditorReferences vs. tab order [message #324686] |
Wed, 30 January 2008 12:43  |
Eclipse User |
|
|
|
Originally posted by: eclipse.risko.hu
Hi,
I were using emacs for some years, and there I were using a keybinding,
which allowed me to switch buffers (editors) with one keystroke, namely
Ctrl-, and Ctrl-. (previous/next).
I found the same concept in Eclipse, the "Next Editor" and "Previous
Editor", but they follow the activation order, what I dislike. I want to
switch editors in the order of the tab area's current layout. If want to
traverse the editors in the order: tab1, tab2, tab3; independently of the
current ordering of tabs and their inputs.
I also dislike the popup-window, I just want the next window be activated
and I will press the key again, if I want to move on.
So I started to implement a little command:
IWorkbenchWindow window =
HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
IEditorPart actEditor = page.getActiveEditor();
IEditorReference[] editors = page.getEditorReferences();
for (int i=0; i<editors.length-1; i++) {
if (editors[i].getEditor(true) == actEditor) {
page.activate(editors[i+1].getEditor(true));
return null;
}
}
page.activate(editors[0].getEditor(true));
But page.getEditorReferences() return the activation order, so this little
code does the same as the builtin, but without the popup.
How can I ask the platform of an Editor position in the tabbar? Or is
there a way to get the editors array (or editorreferences) in the order of
the tabs?
Thanks in advance,
Gergely
|
|
|
Re: IWorkbenchPage.getEditorReferences vs. tab order [message #324691 is a reply to message #324686] |
Wed, 30 January 2008 14:09   |
Eclipse User |
|
|
|
Gergely Risko wrote:
> Hi,
>
> I were using emacs for some years, and there I were using a keybinding,
> which allowed me to switch buffers (editors) with one keystroke, namely
> Ctrl-, and Ctrl-. (previous/next).
>
> I found the same concept in Eclipse, the "Next Editor" and "Previous
> Editor", but they follow the activation order, what I dislike. I want
> to switch editors in the order of the tab area's current layout.
Eclipse only keeps 4 tabs or 8 tabs open (a little more variance, but
you get the idea). You can use CTRL+PAGE_UP/PAGE_DOWN to cycle through
the tabs (until you hit a PDE editor, but that's another story :-). But
that only cycles through the visible tabs.
The page mode keeps track of editors in a MRU (most recently used) list,
and so that's the order of the information that you receive. The
presentation is the model that understands tab order, but because of the
editor reuse options that's not a reliable list of tabs that are
actually open.
All this to say the functionality you want is surprisingly hard to get
at :-)
Later,
PW
--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
|
|
| | | | |
Goto Forum:
Current Time: Wed May 07 12:43:03 EDT 2025
Powered by FUDForum. Page generated in 0.43038 seconds
|