Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Dos Santos2011-07-15 23:26:01 +0000
committerSteffen Pingel2011-07-15 23:26:01 +0000
commit75678454416eba1a9fafc157d016336f3e10c2c4 (patch)
tree4ef68287c9ebd5aa1ccc2c21a740db747b55e06e
parent972b70dede48b9a95748d2140ac538364b67dc19 (diff)
downloadorg.eclipse.mylyn.tasks-75678454416eba1a9fafc157d016336f3e10c2c4.tar.gz
org.eclipse.mylyn.tasks-75678454416eba1a9fafc157d016336f3e10c2c4.tar.xz
org.eclipse.mylyn.tasks-75678454416eba1a9fafc157d016336f3e10c2c4.zip
NEW - bug 321707: [patch][mac][editor] two-finger scroll 'sticks' in
Task Editor text fields https://bugs.eclipse.org/bugs/show_bug.cgi?id=321707
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java70
1 files changed, 48 insertions, 22 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
index da06554ba..0e565a7bd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
@@ -25,6 +25,7 @@ import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFormUtil;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil;
+import org.eclipse.mylyn.internal.provisional.commons.ui.PlatformUiUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog;
import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard.Mode;
@@ -71,6 +72,10 @@ import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
import org.eclipse.ui.internal.WorkbenchPage;
import org.eclipse.ui.internal.forms.widgets.FormUtil;
+/**
+ * @author Steffen Pingel
+ * @author Leo Dos Santos
+ */
public class EditorUtil {
private static final int PAGE_H_SCROLL_INCREMENT = 64;
@@ -565,31 +570,52 @@ public class EditorUtil {
}
public static void addScrollListener(final CCombo combo) {
- combo.addListener(SWT.KeyDown, new Listener() {
- public void handleEvent(Event event) {
- if (event.keyCode == SWT.ARROW_UP) {
- if (combo.isFocusControl()) {
- // could be a legitimate key event, let CCombo handle it
- return;
+ if (PlatformUiUtil.usesMouseWheelEventsForScrolling()) {
+ combo.addListener(SWT.MouseWheel, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.count > 0) {
+ EditorUtil.handleScrollUp(combo, event);
+ } else if (event.count < 0) {
+ EditorUtil.handleScrollDown(combo, event);
}
- ScrolledComposite form = FormUtil.getScrolledComposite(combo);
- if (form != null) {
- EditorUtil.scroll(form, 0, -form.getVerticalBar().getIncrement());
- event.doit = false;
- }
- } else if (event.keyCode == SWT.ARROW_DOWN) {
- if (combo.isFocusControl()) {
- // could be a legitimate key event, let CCombo handle it
- return;
- }
- ScrolledComposite form = FormUtil.getScrolledComposite(combo);
- if (form != null) {
- EditorUtil.scroll(form, 0, form.getVerticalBar().getIncrement());
- event.doit = false;
+ }
+
+ });
+ } else {
+ combo.addListener(SWT.KeyDown, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.keyCode == SWT.ARROW_UP) {
+ EditorUtil.handleScrollUp(combo, event);
+ } else if (event.keyCode == SWT.ARROW_DOWN) {
+ EditorUtil.handleScrollDown(combo, event);
}
}
- }
- });
+ });
+ }
+ }
+
+ private static void handleScrollUp(CCombo combo, Event event) {
+ if (combo.isFocusControl()) {
+ // could be a legitimate key event, let CCombo handle it
+ return;
+ }
+ ScrolledComposite form = FormUtil.getScrolledComposite(combo);
+ if (form != null) {
+ EditorUtil.scroll(form, 0, -form.getVerticalBar().getIncrement());
+ event.doit = false;
+ }
+ }
+
+ private static void handleScrollDown(CCombo combo, Event event) {
+ if (combo.isFocusControl()) {
+ // could be a legitimate key event, let CCombo handle it
+ return;
+ }
+ ScrolledComposite form = FormUtil.getScrolledComposite(combo);
+ if (form != null) {
+ EditorUtil.scroll(form, 0, form.getVerticalBar().getIncrement());
+ event.doit = false;
+ }
}
public static void setTitleBarForeground(ExpandableComposite composite, Color color) {

Back to the top