Mercurial > projects > dwt-addons
diff dwtx/jface/internal/text/StickyHoverManager.d @ 150:5cf141e43417
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 23:05:26 +0200 |
parents | b411f1c62131 |
children | 1a5b8f8129df |
line wrap: on
line diff
--- a/dwtx/jface/internal/text/StickyHoverManager.d Sun Aug 24 22:41:48 2008 +0200 +++ b/dwtx/jface/internal/text/StickyHoverManager.d Sun Aug 24 23:05:26 2008 +0200 @@ -84,7 +84,7 @@ class Closer : IInformationControlCloser, ControlListener, MouseListener, IViewportListener, KeyListener, FocusListener, Listener { //TODO: Catch 'Esc' key in fInformationControlToClose: Don't dispose, just hideInformationControl(). // This would allow to reuse the information control also when the user explicitly closes it. - + //TODO: if subject control is a Scrollable, should add selection listeners to both scroll bars // (and remove the ViewPortListener, which only listens to vertical scrolling) @@ -125,7 +125,7 @@ } fTextViewer.addViewportListener(this); - + IInformationControl fInformationControlToClose= getCurrentInformationControl2(); if (fInformationControlToClose !is null) fInformationControlToClose.addFocusListener(this); @@ -153,11 +153,11 @@ fSubjectControl.removeMouseListener(this); fSubjectControl.removeKeyListener(this); } - + IInformationControl fInformationControlToClose= getCurrentInformationControl2(); if (fInformationControlToClose !is null) fInformationControlToClose.removeFocusListener(this); - + if (fDisplay !is null && !fDisplay.isDisposed()) { fDisplay.removeFilter(DWT.MouseMove, this); fDisplay.removeFilter(DWT.FocusOut, this); @@ -219,18 +219,18 @@ */ public void keyReleased(KeyEvent e) { } - + /* * @see dwt.events.FocusListener#focusGained(dwt.events.FocusEvent) */ public void focusGained(FocusEvent e) { } - + /* * @see dwt.events.FocusListener#focusLost(dwt.events.FocusEvent) */ public void focusLost(FocusEvent e) { - if cast(DEBUG) System.out_.println("StickyHoverManager.Closer.focusLost(): " + e); //$NON-NLS-1$ + if (DEBUG) System.out_.println("StickyHoverManager.Closer.focusLost(): " + e); //$NON-NLS-1$ Display d= fSubjectControl.getDisplay(); d.asyncExec(new class() Runnable { // Without the asyncExec, mouse clicks to the workbench window are swallowed. @@ -239,7 +239,7 @@ } }); } - + /* * @see dwt.widgets.Listener#handleEvent(dwt.widgets.Event) */ @@ -247,10 +247,10 @@ if (event.type is DWT.MouseMove) { if (!( cast(Control)event.widget ) || event.widget.isDisposed()) return; - + IInformationControl infoControl= getCurrentInformationControl2(); if (infoControl !is null && !infoControl.isFocusControl() && cast(IInformationControlExtension3)infoControl ) { -// if cast(DEBUG) System.out_.println("StickyHoverManager.Closer.handleEvent(): activeShell= " + fDisplay.getActiveShell()); //$NON-NLS-1$ +// if (DEBUG) System.out_.println("StickyHoverManager.Closer.handleEvent(): activeShell= " + fDisplay.getActiveShell()); //$NON-NLS-1$ IInformationControlExtension3 iControl3= cast(IInformationControlExtension3) infoControl; Rectangle controlBounds= iControl3.getBounds(); if (controlBounds !is null) { @@ -261,7 +261,7 @@ hideInformationControl(); } } - + } else { /* * TODO: need better understanding of why/if this is needed. @@ -270,9 +270,9 @@ if (fDisplay !is null && !fDisplay.isDisposed()) fDisplay.removeFilter(DWT.MouseMove, this); } - + } else if (event.type is DWT.FocusOut) { - if cast(DEBUG) System.out_.println("StickyHoverManager.Closer.handleEvent(): focusOut: " + event); //$NON-NLS-1$ + if (DEBUG) System.out_.println("StickyHoverManager.Closer.handleEvent(): focusOut: " + event); //$NON-NLS-1$ IInformationControl iControl= getCurrentInformationControl2(); if (iControl !is null && ! iControl.isFocusControl()) hideInformationControl(); @@ -280,21 +280,21 @@ } } - + private const TextViewer fTextViewer; - + /** * Creates a new sticky hover manager. - * + * * @param textViewer the text viewer */ public this(TextViewer textViewer) { super(new DefaultInformationControlCreator()); - + fTextViewer= textViewer; setCloser(new Closer()); - + install(fTextViewer.getTextWidget()); } @@ -305,7 +305,7 @@ if (fTextViewer !is null && fTextViewer.requestWidgetToken(this, WIDGET_PRIORITY)) super.showInformationControl(subjectArea); else - if cast(DEBUG) + if (DEBUG) System.out_.println("cancelled StickyHoverManager.showInformationControl(..): did not get widget token (with prio)"); //$NON-NLS-1$ } @@ -338,7 +338,7 @@ */ public bool requestWidgetToken(IWidgetTokenOwner owner) { hideInformationControl(); - if cast(DEBUG) + if (DEBUG) System.out_.println("StickyHoverManager gave up widget token (no prio)"); //$NON-NLS-1$ return true; } @@ -349,21 +349,21 @@ public bool requestWidgetToken(IWidgetTokenOwner owner, int priority) { if (getCurrentInformationControl2() !is null) { if (getCurrentInformationControl2().isFocusControl()) { - if cast(DEBUG) + if (DEBUG) System.out_.println("StickyHoverManager kept widget token (focused)"); //$NON-NLS-1$ return false; } else if (priority > WIDGET_PRIORITY) { hideInformationControl(); - if cast(DEBUG) + if (DEBUG) System.out_.println("StickyHoverManager gave up widget token (prio)"); //$NON-NLS-1$ return true; } else { - if cast(DEBUG) + if (DEBUG) System.out_.println("StickyHoverManager kept widget token (prio)"); //$NON-NLS-1$ return false; } } - if cast(DEBUG) + if (DEBUG) System.out_.println("StickyHoverManager gave up widget token (no iControl)"); //$NON-NLS-1$ return true; } @@ -384,5 +384,5 @@ iControl.setFocus(); return iControl.isFocusControl(); } - + }