Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » IWorkbenchPage.getEditorReferences vs. tab order
IWorkbenchPage.getEditorReferences vs. tab order [message #324686] Wed, 30 January 2008 12:43 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: IWorkbenchPage.getEditorReferences vs. tab order [message #324694 is a reply to message #324691] Wed, 30 January 2008 14:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.risko.hu

> 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.

Thanks, working nicely. How can I rebind these keys, I don't find them
with the other bindings.

How can I make this mechanism to cycle over from the first tab to the last
and from the last tab to the first?

Thanks,
Gergely
Re: IWorkbenchPage.getEditorReferences vs. tab order [message #324696 is a reply to message #324694] Wed, 30 January 2008 14:55 Go to previous messageGo to next message
Eclipse UserFriend
Gergely Risko wrote:
> How can I make this mechanism to cycle over from the first tab to the
> last and from the last tab to the first?

Neither of those can be done, unfortunately it's simply depending on a
traverse listener in CTabFolder and for whatever reason, it doesn't seem
to respect tab cycling.

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
Re: IWorkbenchPage.getEditorReferences vs. tab order [message #324712 is a reply to message #324696] Wed, 30 January 2008 18:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.risko.hu

And rebinding Ctrl+Pg{Up,Down} is also impossible?

Thanks for your help,
Gergely
Re: IWorkbenchPage.getEditorReferences vs. tab order [message #324744 is a reply to message #324712] Thu, 31 January 2008 10:32 Go to previous message
Eclipse UserFriend
Gergely Risko wrote:
> And rebinding Ctrl+Pg{Up,Down} is also impossible?

Right, that's the Traverse listener, SWT.TRAVERSE_PAGE_NEXT or
SWT.TRAVERSE_PAGE_PREVIOUS

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
Previous Topic:Forms Section with GridLayout and horizontalIndent
Next Topic:Key bindings for Eclipse-Commands
Goto Forum:
  


Current Time: Tue May 06 21:12:48 EDT 2025

Powered by FUDForum. Page generated in 0.25809 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top