Lines 72-77
Link Here
|
72 |
|
72 |
|
73 |
private Listener backForwardListener; |
73 |
private Listener backForwardListener; |
74 |
|
74 |
|
|
|
75 |
private Listener swipeListener; |
76 |
|
75 |
/** |
77 |
/** |
76 |
* Constructs a new instance of <code>BindingService</code> using a JFace |
78 |
* Constructs a new instance of <code>BindingService</code> using a JFace |
77 |
* binding manager. |
79 |
* binding manager. |
Lines 147-152
Link Here
|
147 |
} |
149 |
} |
148 |
}; |
150 |
}; |
149 |
display.addFilter(SWT.MouseDown, backForwardListener); |
151 |
display.addFilter(SWT.MouseDown, backForwardListener); |
|
|
152 |
|
153 |
// Hook up swipe left / right events |
154 |
swipeListener = new Listener() { |
155 |
public void handleEvent(Event event) { |
156 |
if (event.detail != SWT.GESTURE_SWIPE) |
157 |
return; |
158 |
|
159 |
String commandId; |
160 |
if (event.xDirection < 0) { |
161 |
commandId = IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY; |
162 |
} else if (event.xDirection > 0) { |
163 |
commandId = IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY; |
164 |
} else { |
165 |
return; |
166 |
} |
167 |
|
168 |
final IHandlerService handlerService = (IHandlerService) workbench |
169 |
.getService(IHandlerService.class); |
170 |
|
171 |
try { |
172 |
handlerService.executeCommand(commandId, event); |
173 |
event.doit = false; |
174 |
} catch (NotDefinedException e) { |
175 |
// regular condition; do nothing |
176 |
} catch (NotEnabledException e) { |
177 |
// regular condition; do nothing |
178 |
} catch (NotHandledException e) { |
179 |
// regular condition; do nothing |
180 |
} catch (ExecutionException ex) { |
181 |
StatusUtil.handleStatus(ex, StatusManager.SHOW | StatusManager.LOG); |
182 |
} |
183 |
} |
184 |
}; |
185 |
display.addFilter(SWT.Gesture, swipeListener); |
150 |
} |
186 |
} |
151 |
|
187 |
|
152 |
/** |
188 |
/** |