Mercurial > projects > dwt-addons
annotate dwtx/jface/text/hyperlink/HyperlinkManager.d @ 159:7926b636c282
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 01:57:58 +0200 |
parents | f70d9508c95c |
children | 3678e4f1a766 |
rev | line source |
---|---|
129 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2008 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Steffen Pingel <steffen.pingel@tasktop.com> (Tasktop Technologies Inc.) - [navigation] hyperlink decoration is not erased when mouse is moved out of Text widget - https://bugs.eclipse.org/bugs/show_bug.cgi?id=100278 | |
11 * Port to the D programming language: | |
12 * Frank Benoit <benoit@tionex.de> | |
13 *******************************************************************************/ | |
14 module dwtx.jface.text.hyperlink.HyperlinkManager; | |
15 | |
131 | 16 import dwtx.jface.text.hyperlink.IHyperlinkPresenterExtension; // packageimport |
17 import dwtx.jface.text.hyperlink.MultipleHyperlinkPresenter; // packageimport | |
18 import dwtx.jface.text.hyperlink.URLHyperlink; // packageimport | |
19 import dwtx.jface.text.hyperlink.IHyperlinkDetectorExtension2; // packageimport | |
20 import dwtx.jface.text.hyperlink.IHyperlinkDetector; // packageimport | |
21 import dwtx.jface.text.hyperlink.IHyperlinkPresenter; // packageimport | |
22 import dwtx.jface.text.hyperlink.URLHyperlinkDetector; // packageimport | |
23 import dwtx.jface.text.hyperlink.DefaultHyperlinkPresenter; // packageimport | |
24 import dwtx.jface.text.hyperlink.AbstractHyperlinkDetector; // packageimport | |
25 import dwtx.jface.text.hyperlink.IHyperlinkDetectorExtension; // packageimport | |
26 import dwtx.jface.text.hyperlink.HyperlinkMessages; // packageimport | |
27 import dwtx.jface.text.hyperlink.IHyperlink; // packageimport | |
28 | |
29 | |
129 | 30 import dwt.dwthelper.utils; |
153
f70d9508c95c
Fix java Collection imports
Frank Benoit <benoit@tionex.de>
parents:
147
diff
changeset
|
31 import dwtx.dwtxhelper.Collection; |
f70d9508c95c
Fix java Collection imports
Frank Benoit <benoit@tionex.de>
parents:
147
diff
changeset
|
32 |
129 | 33 import dwt.DWT; |
34 import dwt.custom.StyledText; | |
35 import dwt.events.FocusEvent; | |
36 import dwt.events.FocusListener; | |
37 import dwt.events.KeyEvent; | |
38 import dwt.events.KeyListener; | |
39 import dwt.events.MouseEvent; | |
40 import dwt.events.MouseListener; | |
41 import dwt.events.MouseMoveListener; | |
42 import dwt.events.MouseTrackListener; | |
43 import dwt.graphics.Point; | |
44 import dwt.widgets.Display; | |
45 import dwt.widgets.Event; | |
46 import dwt.widgets.Listener; | |
47 import dwtx.core.runtime.Assert; | |
48 import dwtx.jface.text.IRegion; | |
49 import dwtx.jface.text.ITextListener; | |
50 import dwtx.jface.text.ITextViewer; | |
51 import dwtx.jface.text.ITextViewerExtension5; | |
52 import dwtx.jface.text.Region; | |
53 import dwtx.jface.text.TextEvent; | |
54 | |
55 | |
56 /** | |
57 * Default implementation of a hyperlink manager. | |
58 * | |
59 * @since 3.1 | |
60 */ | |
61 public class HyperlinkManager : ITextListener, Listener, KeyListener, MouseListener, MouseMoveListener, FocusListener, MouseTrackListener { | |
62 | |
63 /** | |
64 * Detection strategy. | |
65 */ | |
66 public static final class DETECTION_STRATEGY { | |
67 | |
68 String fName; | |
69 | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
70 private this(String name) { |
129 | 71 fName= name; |
72 } | |
73 | |
74 /* | |
75 * @see java.lang.Object#toString() | |
76 */ | |
77 public String toString() { | |
78 return fName; | |
79 } | |
80 } | |
81 | |
82 | |
83 /** | |
84 * The first detected hyperlink is passed to the | |
85 * hyperlink presenter and no further detector | |
86 * is consulted. | |
87 */ | |
147 | 88 public static const DETECTION_STRATEGY FIRST= new DETECTION_STRATEGY("first"); //$NON-NLS-1$ |
129 | 89 |
90 /** | |
91 * All detected hyperlinks from all detectors are collected | |
92 * and passed to the hyperlink presenter. | |
93 * <p> | |
94 * This strategy is only allowed if {@link IHyperlinkPresenter#canShowMultipleHyperlinks()} | |
95 * returns <code>true</code>. | |
96 * </p> | |
97 */ | |
147 | 98 public static const DETECTION_STRATEGY ALL= new DETECTION_STRATEGY("all"); //$NON-NLS-1$ |
129 | 99 |
100 /** | |
101 * All detected hyperlinks from all detectors are collected | |
102 * and all those with the longest region are passed to the | |
103 * hyperlink presenter. | |
104 * <p> | |
105 * This strategy is only allowed if {@link IHyperlinkPresenter#canShowMultipleHyperlinks()} | |
106 * returns <code>true</code>. | |
107 * </p> | |
108 */ | |
147 | 109 public static const DETECTION_STRATEGY LONGEST_REGION_ALL= new DETECTION_STRATEGY("all with same longest region"); //$NON-NLS-1$ |
129 | 110 |
111 /** | |
112 * All detected hyperlinks from all detectors are collected | |
113 * and form all those with the longest region only the first | |
114 * one is passed to the hyperlink presenter. | |
115 */ | |
147 | 116 public static const DETECTION_STRATEGY LONGEST_REGION_FIRST= new DETECTION_STRATEGY("first with longest region"); //$NON-NLS-1$ |
129 | 117 |
118 | |
119 /** The text viewer on which this hyperlink manager works. */ | |
120 private ITextViewer fTextViewer; | |
121 /** The session is active. */ | |
122 private bool fActive; | |
123 /** The key modifier mask. */ | |
124 private int fHyperlinkStateMask; | |
125 /** | |
126 * The active key modifier mask. | |
127 * @since 3.3 | |
128 */ | |
129 private int fActiveHyperlinkStateMask; | |
130 /** The active hyperlinks. */ | |
131 private IHyperlink[] fActiveHyperlinks; | |
132 /** The hyperlink detectors. */ | |
133 private IHyperlinkDetector[] fHyperlinkDetectors; | |
134 /** The hyperlink presenter. */ | |
135 private IHyperlinkPresenter fHyperlinkPresenter; | |
136 /** The detection strategy. */ | |
146 | 137 private const DETECTION_STRATEGY fDetectionStrategy; |
129 | 138 |
139 | |
140 /** | |
141 * Creates a new hyperlink manager. | |
142 * | |
143 * @param detectionStrategy the detection strategy one of {{@link #ALL}, {@link #FIRST}, {@link #LONGEST_REGION_ALL}, {@link #LONGEST_REGION_FIRST}} | |
144 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
145 public this(DETECTION_STRATEGY detectionStrategy) { |
129 | 146 Assert.isNotNull(detectionStrategy); |
147 fDetectionStrategy= detectionStrategy; | |
148 } | |
149 | |
150 /** | |
151 * Installs this hyperlink manager with the given arguments. | |
152 * | |
153 * @param textViewer the text viewer | |
154 * @param hyperlinkPresenter the hyperlink presenter | |
155 * @param hyperlinkDetectors the array of hyperlink detectors, must not be empty | |
156 * @param eventStateMask the DWT event state mask to activate hyperlink mode | |
157 */ | |
158 public void install(ITextViewer textViewer, IHyperlinkPresenter hyperlinkPresenter, IHyperlinkDetector[] hyperlinkDetectors, int eventStateMask) { | |
159 Assert.isNotNull(textViewer); | |
160 Assert.isNotNull(hyperlinkPresenter); | |
161 fTextViewer= textViewer; | |
162 fHyperlinkPresenter= hyperlinkPresenter; | |
163 Assert.isLegal(fHyperlinkPresenter.canShowMultipleHyperlinks() || fDetectionStrategy is FIRST || fDetectionStrategy is LONGEST_REGION_FIRST); | |
164 setHyperlinkDetectors(hyperlinkDetectors); | |
165 setHyperlinkStateMask(eventStateMask); | |
166 | |
167 StyledText text= fTextViewer.getTextWidget(); | |
168 if (text is null || text.isDisposed()) | |
169 return; | |
170 | |
171 text.getDisplay().addFilter(DWT.KeyUp, this); | |
172 text.addKeyListener(this); | |
173 text.addMouseListener(this); | |
174 text.addMouseMoveListener(this); | |
175 text.addFocusListener(this); | |
176 text.addMouseTrackListener(this); | |
177 | |
178 fTextViewer.addTextListener(this); | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
179 |
129 | 180 fHyperlinkPresenter.install(fTextViewer); |
181 } | |
182 | |
183 /** | |
184 * Sets the hyperlink detectors for this hyperlink manager. | |
185 * <p> | |
186 * It is allowed to call this method after this | |
187 * hyperlink manger has been installed. | |
188 * </p> | |
189 * | |
190 * @param hyperlinkDetectors and array of hyperlink detectors, must not be empty | |
191 */ | |
192 public void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors) { | |
193 Assert.isTrue(hyperlinkDetectors !is null && hyperlinkDetectors.length > 0); | |
194 if (fHyperlinkDetectors is null) | |
195 fHyperlinkDetectors= hyperlinkDetectors; | |
196 else { | |
197 synchronized (fHyperlinkDetectors) { | |
198 fHyperlinkDetectors= hyperlinkDetectors; | |
199 } | |
200 } | |
201 } | |
202 | |
203 /** | |
204 * Sets the DWT event state mask which in combination | |
205 * with the left mouse button triggers the hyperlink mode. | |
206 * <p> | |
207 * It is allowed to call this method after this | |
208 * hyperlink manger has been installed. | |
209 * </p> | |
210 * | |
211 * @param eventStateMask the DWT event state mask to activate hyperlink mode | |
212 */ | |
213 public void setHyperlinkStateMask(int eventStateMask) { | |
214 fHyperlinkStateMask= eventStateMask; | |
215 } | |
216 | |
217 /** | |
218 * Uninstalls this hyperlink manager. | |
219 */ | |
220 public void uninstall() { | |
221 deactivate(); | |
222 | |
223 StyledText text= fTextViewer.getTextWidget(); | |
224 if (text !is null && !text.isDisposed()) { | |
225 text.removeKeyListener(this); | |
226 text.getDisplay().removeFilter(DWT.KeyUp, this); | |
227 text.removeMouseListener(this); | |
228 text.removeMouseMoveListener(this); | |
229 text.removeFocusListener(this); | |
230 text.removeMouseTrackListener(this); | |
231 } | |
232 fTextViewer.removeTextListener(this); | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
233 |
129 | 234 fHyperlinkPresenter.uninstall(); |
235 | |
236 fHyperlinkPresenter= null; | |
237 fTextViewer= null; | |
238 fHyperlinkDetectors= null; | |
239 } | |
240 | |
241 /** | |
242 * Deactivates the currently shown hyperlinks. | |
243 */ | |
244 protected void deactivate() { | |
245 fHyperlinkPresenter.hideHyperlinks(); | |
246 fActive= false; | |
247 } | |
248 | |
249 /** | |
250 * Finds hyperlinks at the current offset. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
251 * |
129 | 252 * @return the hyperlinks or <code>null</code> if none. |
253 */ | |
254 protected IHyperlink[] findHyperlinks() { | |
255 int offset= getCurrentTextOffset(); | |
256 if (offset is -1) | |
257 return null; | |
258 | |
259 bool canShowMultipleHyperlinks= fHyperlinkPresenter.canShowMultipleHyperlinks(); | |
260 IRegion region= new Region(offset, 0); | |
261 List allHyperlinks= new ArrayList(fHyperlinkDetectors.length * 2); | |
262 synchronized (fHyperlinkDetectors) { | |
263 for (int i= 0, length= fHyperlinkDetectors.length; i < length; i++) { | |
264 IHyperlinkDetector detector= fHyperlinkDetectors[i]; | |
265 if (detector is null) | |
266 continue; | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
267 |
138 | 268 if ( cast(IHyperlinkDetectorExtension2)detector ) { |
134 | 269 int stateMask= (cast(IHyperlinkDetectorExtension2)detector).getStateMask(); |
129 | 270 if (stateMask !is -1 && stateMask !is fActiveHyperlinkStateMask) |
271 continue; | |
272 else if (stateMask is -1 && fActiveHyperlinkStateMask !is fHyperlinkStateMask) | |
273 continue; | |
274 } else if (fActiveHyperlinkStateMask !is fHyperlinkStateMask) | |
275 continue; | |
276 | |
277 IHyperlink[] hyperlinks= detector.detectHyperlinks(fTextViewer, region, canShowMultipleHyperlinks); | |
278 if (hyperlinks is null) | |
279 continue; | |
280 | |
281 Assert.isLegal(hyperlinks.length > 0); | |
282 | |
283 if (fDetectionStrategy is FIRST) { | |
284 if (hyperlinks.length is 1) | |
285 return hyperlinks; | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
286 return [hyperlinks[0]]; |
129 | 287 } |
288 allHyperlinks.addAll(Arrays.asList(hyperlinks)); | |
289 } | |
290 } | |
291 | |
292 if (allHyperlinks.isEmpty()) | |
293 return null; | |
294 | |
295 if (fDetectionStrategy !is ALL) { | |
296 int maxLength= computeLongestHyperlinkLength(allHyperlinks); | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
297 Iterator iter= (new ArrayList(allHyperlinks)).iterator(); |
129 | 298 while (iter.hasNext()) { |
134 | 299 IHyperlink hyperlink= cast(IHyperlink)iter.next(); |
129 | 300 if (hyperlink.getHyperlinkRegion().getLength() < maxLength) |
301 allHyperlinks.remove(hyperlink); | |
302 } | |
303 } | |
304 | |
305 if (fDetectionStrategy is LONGEST_REGION_FIRST) | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
306 return [cast(IHyperlink)allHyperlinks.get(0)]; |
129 | 307 |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
308 return arraycast!(IHyperlink)(allHyperlinks.toArray()); |
129 | 309 |
310 } | |
311 | |
312 /** | |
313 * Computes the length of the longest detected | |
314 * hyperlink. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
315 * |
129 | 316 * @param hyperlinks |
317 * @return the length of the longest detected | |
318 */ | |
319 protected int computeLongestHyperlinkLength(List hyperlinks) { | |
320 Assert.isLegal(hyperlinks !is null && !hyperlinks.isEmpty()); | |
321 Iterator iter= hyperlinks.iterator(); | |
322 int length= Integer.MIN_VALUE; | |
323 while (iter.hasNext()) { | |
134 | 324 IRegion region= (cast(IHyperlink)iter.next()).getHyperlinkRegion(); |
129 | 325 if (region.getLength() < length) |
326 continue; | |
327 length= region.getLength(); | |
328 } | |
329 return length; | |
330 } | |
331 | |
332 /** | |
333 * Returns the current text offset. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
334 * |
129 | 335 * @return the current text offset |
336 */ | |
337 protected int getCurrentTextOffset() { | |
338 | |
339 try { | |
340 StyledText text= fTextViewer.getTextWidget(); | |
341 if (text is null || text.isDisposed()) | |
342 return -1; | |
343 | |
344 Display display= text.getDisplay(); | |
345 Point absolutePosition= display.getCursorLocation(); | |
346 Point relativePosition= text.toControl(absolutePosition); | |
347 | |
348 int widgetOffset= text.getOffsetAtLocation(relativePosition); | |
349 Point p= text.getLocationAtOffset(widgetOffset); | |
350 if (p.x > relativePosition.x) | |
351 widgetOffset--; | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
352 |
138 | 353 if ( cast(ITextViewerExtension5)fTextViewer ) { |
134 | 354 ITextViewerExtension5 extension= cast(ITextViewerExtension5)fTextViewer; |
129 | 355 return extension.widgetOffset2ModelOffset(widgetOffset); |
356 } | |
357 | |
358 return widgetOffset + fTextViewer.getVisibleRegion().getOffset(); | |
359 | |
360 } catch (IllegalArgumentException e) { | |
361 return -1; | |
362 } | |
363 } | |
364 | |
365 /* | |
366 * @see dwt.events.KeyListener#keyPressed(dwt.events.KeyEvent) | |
367 */ | |
368 public void keyPressed(KeyEvent event) { | |
369 | |
370 if (fActive) { | |
371 deactivate(); | |
372 return; | |
373 } | |
374 | |
375 if (!isRegisteredStateMask(event.keyCode)) { | |
376 deactivate(); | |
377 return; | |
378 } | |
379 | |
380 fActive= true; | |
381 fActiveHyperlinkStateMask= event.keyCode; | |
382 | |
383 // removed for #25871 (hyperlinks could interact with typing) | |
384 // | |
385 // ITextViewer viewer= getSourceViewer(); | |
386 // if (viewer is null) | |
387 // return; | |
388 // | |
389 // IRegion region= getCurrentTextRegion(viewer); | |
390 // if (region is null) | |
391 // return; | |
392 // | |
393 // highlightRegion(viewer, region); | |
394 // activateCursor(viewer); | |
395 } | |
396 | |
397 /* | |
398 * @see dwt.events.KeyListener#keyReleased(dwt.events.KeyEvent) | |
399 */ | |
400 public void keyReleased(KeyEvent event) { | |
401 } | |
402 | |
403 /* | |
404 * @see dwt.events.MouseListener#mouseDoubleClick(dwt.events.MouseEvent) | |
405 */ | |
406 public void mouseDoubleClick(MouseEvent e) { | |
407 | |
408 } | |
409 | |
410 /* | |
411 * @see dwt.events.MouseListener#mouseDown(dwt.events.MouseEvent) | |
412 */ | |
413 public void mouseDown(MouseEvent event) { | |
414 | |
415 if (!fActive) | |
416 return; | |
417 | |
418 if (event.stateMask !is fActiveHyperlinkStateMask) { | |
419 deactivate(); | |
420 return; | |
421 } | |
422 | |
423 if (event.button !is 1) { | |
424 deactivate(); | |
425 return; | |
426 } | |
427 } | |
428 | |
429 /* | |
430 * @see dwt.events.MouseListener#mouseUp(dwt.events.MouseEvent) | |
431 */ | |
432 public void mouseUp(MouseEvent e) { | |
433 | |
434 if (!fActive) { | |
435 fActiveHyperlinks= null; | |
436 return; | |
437 } | |
438 | |
439 if (e.button !is 1) | |
440 fActiveHyperlinks= null; | |
441 | |
442 deactivate(); | |
443 | |
444 if (fActiveHyperlinks !is null) | |
445 fActiveHyperlinks[0].open(); | |
446 } | |
447 | |
448 /* | |
449 * @see dwt.events.MouseMoveListener#mouseMove(dwt.events.MouseEvent) | |
450 */ | |
451 public void mouseMove(MouseEvent event) { | |
138 | 452 if ( cast(IHyperlinkPresenterExtension)fHyperlinkPresenter ) { |
134 | 453 if (!(cast(IHyperlinkPresenterExtension)fHyperlinkPresenter).canHideHyperlinks()) |
129 | 454 return; |
455 } | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
456 |
129 | 457 if (!isRegisteredStateMask(event.stateMask)) { |
458 if (fActive) | |
459 deactivate(); | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
460 |
129 | 461 return; |
462 } | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
463 |
129 | 464 fActive= true; |
465 fActiveHyperlinkStateMask= event.stateMask; | |
466 | |
467 StyledText text= fTextViewer.getTextWidget(); | |
468 if (text is null || text.isDisposed()) { | |
469 deactivate(); | |
470 return; | |
471 } | |
472 | |
473 if ((event.stateMask & DWT.BUTTON1) !is 0 && text.getSelectionCount() !is 0) { | |
474 deactivate(); | |
475 return; | |
476 } | |
477 | |
478 fActiveHyperlinks= findHyperlinks(); | |
479 if (fActiveHyperlinks is null || fActiveHyperlinks.length is 0) { | |
480 fHyperlinkPresenter.hideHyperlinks(); | |
481 return; | |
482 } | |
483 | |
484 fHyperlinkPresenter.showHyperlinks(fActiveHyperlinks); | |
485 | |
486 } | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
487 |
129 | 488 /** |
489 * Checks whether the given state mask is registered. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
490 * |
129 | 491 * @param stateMask |
492 * @return <code>true</code> if a detector is registered for the given state mask | |
493 * @since 3.3 | |
494 */ | |
495 private bool isRegisteredStateMask(int stateMask) { | |
496 if (stateMask is fHyperlinkStateMask) | |
497 return true; | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
498 |
129 | 499 synchronized (fHyperlinkDetectors) { |
500 for (int i= 0; i < fHyperlinkDetectors.length; i++) { | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
501 if (cast(IHyperlinkDetectorExtension2)fHyperlinkDetectors[i] ) { |
134 | 502 if (stateMask is (cast(IHyperlinkDetectorExtension2)fHyperlinkDetectors[i]).getStateMask()) |
129 | 503 return true; |
504 } | |
505 } | |
506 } | |
507 return false; | |
508 } | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
509 |
129 | 510 /* |
511 * @see dwt.events.FocusListener#focusGained(dwt.events.FocusEvent) | |
512 */ | |
513 public void focusGained(FocusEvent e) {} | |
514 | |
515 /* | |
516 * @see dwt.events.FocusListener#focusLost(dwt.events.FocusEvent) | |
517 */ | |
518 public void focusLost(FocusEvent event) { | |
519 deactivate(); | |
520 } | |
521 | |
522 /* | |
523 * @see dwt.widgets.Listener#handleEvent(dwt.widgets.Event) | |
524 * @since 3.2 | |
525 */ | |
526 public void handleEvent(Event event) { | |
527 //key up | |
528 deactivate(); | |
529 } | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
530 |
129 | 531 /* |
532 * @see dwtx.jface.text.ITextListener#textChanged(TextEvent) | |
533 * @since 3.2 | |
534 */ | |
535 public void textChanged(TextEvent event) { | |
536 if (event.getDocumentEvent() !is null) | |
537 deactivate(); | |
538 } | |
539 | |
540 /** | |
541 * {@inheritDoc} | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
542 * |
129 | 543 * @since 3.4 |
544 */ | |
545 public void mouseExit(MouseEvent e) { | |
138 | 546 if ( cast(IHyperlinkPresenterExtension)fHyperlinkPresenter ) { |
134 | 547 if (!(cast(IHyperlinkPresenterExtension)fHyperlinkPresenter).canHideHyperlinks()) |
129 | 548 return; |
549 } | |
550 deactivate(); | |
551 } | |
552 | |
553 /** | |
554 * {@inheritDoc} | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
555 * |
129 | 556 * @since 3.4 |
557 */ | |
558 public void mouseEnter(MouseEvent e) { | |
559 } | |
560 | |
561 /** | |
562 * {@inheritDoc} | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
138
diff
changeset
|
563 * |
129 | 564 * @since 3.4 |
565 */ | |
566 public void mouseHover(MouseEvent e) { | |
567 } | |
568 | |
569 } |