Lines 7-13
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
* Remy Chi Jian Suen <remy.suen@gmail.com> - Bug 145557 [WorkbenchParts] Content description label needs a hover |
10 |
* Remy Chi Jian Suen <remy.suen@gmail.com> |
|
|
11 |
* - Bug 145557 [WorkbenchParts] Content description label needs a hover |
12 |
* - Bug 158910 [GTK/Linux] Support switching tabs by mousewheel scrolling w/ Gtk |
11 |
*******************************************************************************/ |
13 |
*******************************************************************************/ |
12 |
package org.eclipse.ui.internal.presentations.defaultpresentation; |
14 |
package org.eclipse.ui.internal.presentations.defaultpresentation; |
13 |
|
15 |
|
Lines 86-91
Link Here
|
86 |
} |
88 |
} |
87 |
} |
89 |
} |
88 |
}; |
90 |
}; |
|
|
91 |
|
92 |
private Listener mouseWheelListener = new Listener() { |
93 |
public void handleEvent(Event e) { |
94 |
int index = paneFolder.getSelectionIndex(); |
95 |
int numItems = paneFolder.getItemCount(); |
96 |
// make sure that the tab folder has an item selected and that we |
97 |
// actually have an item to jump to |
98 |
if (index != -1 && numItems != 1) { |
99 |
int selectionIndex = index; |
100 |
// positive e.count value implies up |
101 |
if (e.count > 0) { |
102 |
// increment by one since we're moving to the next tab |
103 |
index++; |
104 |
// if we're on the last tab, we need to move forward back to the beginning |
105 |
selectionIndex = index == numItems ? 0 : index; |
106 |
} else { |
107 |
// if we're on the first tab, rotate backwards to the final one, |
108 |
// otherwise, decrement the index by one |
109 |
selectionIndex = index == 0 ? numItems - 1 : index - 1; |
110 |
} |
111 |
paneFolder.setSelection(selectionIndex); |
112 |
// fire a selection event so that the contents are actually swapped |
113 |
fireEvent(TabFolderEvent.EVENT_TAB_SELECTED, getSelection()); |
114 |
} |
115 |
} |
116 |
}; |
89 |
|
117 |
|
90 |
private static DefaultTabFolderColors defaultColors = new DefaultTabFolderColors(); |
118 |
private static DefaultTabFolderColors defaultColors = new DefaultTabFolderColors(); |
91 |
|
119 |
|
Lines 106-111
Link Here
|
106 |
paneFolder.addButtonListener(buttonListener); |
134 |
paneFolder.addButtonListener(buttonListener); |
107 |
paneFolder.setMinimizeVisible(allowMin); |
135 |
paneFolder.setMinimizeVisible(allowMin); |
108 |
paneFolder.setMaximizeVisible(allowMax); |
136 |
paneFolder.setMaximizeVisible(allowMax); |
|
|
137 |
paneFolder.getControl().addListener(SWT.MouseWheel, mouseWheelListener); |
109 |
paneFolder.getControl().addListener(SWT.Selection, selectionListener); |
138 |
paneFolder.getControl().addListener(SWT.Selection, selectionListener); |
110 |
paneFolder.setTopRight(null); |
139 |
paneFolder.setTopRight(null); |
111 |
|
140 |
|