### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.workbench Index: Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultTabFolder.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultTabFolder.java,v retrieving revision 1.22 diff -u -r1.22 DefaultTabFolder.java --- Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultTabFolder.java 20 Dec 2006 20:52:07 -0000 1.22 +++ Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultTabFolder.java 5 Apr 2008 00:42:38 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. + * Copyright (c) 2004, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -86,6 +86,34 @@ } }; + private Listener mouseWheelListener = new Listener() { + public void handleEvent(Event e) { + int index = paneFolder.getSelectionIndex(); + // make sure that the tab folder has an item selected + if (index != -1) { + // positive e.count value implies up + if (e.count > 0) { + index++; + if (index == paneFolder.getItems().length) { + // since we're on the last tab, rotate forward to the first tab + paneFolder.setSelection(0); + } else { + paneFolder.setSelection(index); + } + } else { + if (index == 0) { + // on the first tab, rotate backwards to the last tab + paneFolder.setSelection(paneFolder.getItems().length - 1); + } else { + paneFolder.setSelection(index - 1); + } + } + // fire a selection event so that the contents are actually swapped + fireEvent(TabFolderEvent.EVENT_TAB_SELECTED, getSelection(), getPaneMenuLocation()); + } + } + }; + private static DefaultTabFolderColors defaultColors = new DefaultTabFolderColors(); private DefaultTabFolderColors[] activeShellColors = {defaultColors, defaultColors, defaultColors}; @@ -105,6 +133,7 @@ paneFolder.addButtonListener(buttonListener); paneFolder.setMinimizeVisible(allowMin); paneFolder.setMaximizeVisible(allowMax); + paneFolder.getControl().addListener(SWT.MouseWheel, mouseWheelListener); paneFolder.getControl().addListener(SWT.Selection, selectionListener); paneFolder.setTopRight(null);