Mercurial > projects > dwt-addons
diff dwtx/jface/text/TextViewerHoverManager.d @ 172:d994a8b2cdf7
again compile fixes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 10 Sep 2008 23:14:02 +0200 |
parents | 862b05e0334a |
children |
line wrap: on
line diff
--- a/dwtx/jface/text/TextViewerHoverManager.d Wed Sep 10 22:45:07 2008 +0200 +++ b/dwtx/jface/text/TextViewerHoverManager.d Wed Sep 10 23:14:02 2008 +0200 @@ -278,19 +278,19 @@ return; } - final ITextHover hover= fTextViewer.getTextHover_package(offset, getHoverEventStateMask()); + ITextHover hover= fTextViewer.getTextHover_package(offset, getHoverEventStateMask()); if (hover is null) { setInformation(cast(Object)null, null); return; } - final IRegion region= hover.getHoverRegion(fTextViewer, offset); + IRegion region= hover.getHoverRegion(fTextViewer, offset); if (region is null) { setInformation(cast(Object)null, null); return; } - final Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer); + Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer); if (area is null || area.isEmpty()) { setInformation(cast(Object)null, null); return; @@ -300,59 +300,58 @@ setInformation(cast(Object)null, null); return; } - - void threadrun() { - // http://bugs.eclipse.org/bugs/show_bug.cgi?id=17693 - bool hasFinished= false; - try { - if (fThread !is null) { - Object information; - try { - if ( cast(ITextHoverExtension2)hover ) - information= (cast(ITextHoverExtension2)hover).getHoverInfo2(fTextViewer, region); - else - information= stringcast(hover.getHoverInfo(fTextViewer, region)); - } catch (ArrayIndexOutOfBoundsException x) { - /* - * This code runs in a separate thread which can - * lead to text offsets being out of bounds when - * computing the hover info (see bug 32848). - */ - information= null; - } + fThread= new JThread( dgRunnable( (ITextHover hover_, IRegion region_, Rectangle area_){ + // http://bugs.eclipse.org/bugs/show_bug.cgi?id=17693 + bool hasFinished= false; + try { + if (fThread !is null) { + Object information; + try { + if ( cast(ITextHoverExtension2)hover_ ) + information= (cast(ITextHoverExtension2)hover_).getHoverInfo2(fTextViewer, region_); + else + information= stringcast(hover_.getHoverInfo(fTextViewer, region_)); + } catch (ArrayIndexOutOfBoundsException x) { + /* + * This code runs in a separate thread which can + * lead to text offsets being out of bounds when + * computing the hover info (see bug 32848). + */ + information= null; + } - if ( cast(ITextHoverExtension)hover ) - setCustomInformationControlCreator((cast(ITextHoverExtension) hover).getHoverControlCreator()); - else - setCustomInformationControlCreator(null); + if ( cast(ITextHoverExtension)hover_ ) + setCustomInformationControlCreator((cast(ITextHoverExtension) hover_).getHoverControlCreator()); + else + setCustomInformationControlCreator(null); - setInformation(information, area); - if (information !is null) - fTextHover= hover; - } else { + setInformation(information, area_); + if (information !is null) + fTextHover= hover_; + } else { + setInformation(cast(Object)null, null); + } + hasFinished= true; + } catch (RuntimeException ex) { + String PLUGIN_ID= "dwtx.jface.text"; //$NON-NLS-1$ + ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); + log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Unexpected runtime error while computing a text hover", ex)); //$NON-NLS-1$ + } finally { + synchronized (fMutex) { + if (fTextViewer !is null) + fTextViewer.removeTextListener(fStopper); + fThread= null; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=44756 + if (!hasFinished) setInformation(cast(Object)null, null); - } - hasFinished= true; - } catch (RuntimeException ex) { - String PLUGIN_ID= "dwtx.jface.text"; //$NON-NLS-1$ - ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); - log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Unexpected runtime error while computing a text hover", ex)); //$NON-NLS-1$ - } finally { - synchronized (fMutex) { - if (fTextViewer !is null) - fTextViewer.removeTextListener(fStopper); - fThread= null; - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=44756 - if (!hasFinished) - setInformation(cast(Object)null, null); - } } } - fThread= new Thread( &threadrun ); - fThread.name = "Text Viewer Hover Presenter"; //$NON-NLS-1$ + }, hover, region, area ) ); - fThread.isDaemon(true); - fThread.priority(Thread.PRIORITY_MIN); + fThread.setName( "Text Viewer Hover Presenter" ); //$NON-NLS-1$ + + fThread.setDaemon(true); + fThread.setPriority(JThread.MIN_PRIORITY); synchronized (fMutex) { fTextViewer.addTextListener(fStopper); fThread.start();