Mercurial > projects > dwt-addons
diff dwtx/jface/internal/text/link/contentassist/AdditionalInfoController2.d @ 168:cef27f663573
jface.text ...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 09 Sep 2008 17:44:11 +0200 |
parents | 862b05e0334a |
children |
line wrap: on
line diff
--- a/dwtx/jface/internal/text/link/contentassist/AdditionalInfoController2.d Tue Sep 09 15:59:16 2008 +0200 +++ b/dwtx/jface/internal/text/link/contentassist/AdditionalInfoController2.d Tue Sep 09 17:44:11 2008 +0200 @@ -26,6 +26,8 @@ import dwt.dwthelper.utils; import dwtx.dwtxhelper.JThread; +import tango.core.sync.Mutex; +import tango.core.sync.Condition; import dwt.events.SelectionEvent; import dwt.events.SelectionListener; @@ -76,11 +78,13 @@ /** Indicates whether the display delay has been reset */ private bool fIsReset= false; /** Object to synchronize display thread and table selection changes */ - private const Object fMutex; + private const Mutex fMutex; + private const Condition fMutex_cond; /** Thread access lock. */ private const Object fThreadAccess; /** Object to synchronize initial display of additional info */ - private Object fStartSignal; + private Mutex fStartSignal; + private Condition fStartSignal_cond; /** The table selection listener */ private SelectionListener fSelectionListener; /** The delay after which additional information is displayed */ @@ -96,7 +100,8 @@ this(IInformationControlCreator creator, int delay) { fSelectionListener= new TableSelectionListener(); fThreadAccess= new Object(); - fMutex= new Object(); + fMutex= new Mutex(); + fMutex_cond= new Condition(fMutex); super(creator); fDelay= delay; setAnchor(ANCHOR_RIGHT); @@ -123,12 +128,13 @@ fThread.interrupt(); fThread= new JThread(this, ContentAssistMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ - fStartSignal= new Object(); + fStartSignal= new Mutex(); + fStartSignal_cond= new Condition(fStartSignal); synchronized (fStartSignal) { fThread.start(); try { // wait until thread is ready - fStartSignal.wait(); + fStartSignal_cond.wait(); } catch (InterruptedException x) { } } @@ -166,18 +172,19 @@ if (fStartSignal !is null) { synchronized (fStartSignal) { - fStartSignal.notifyAll(); + fStartSignal_cond.notifyAll(); fStartSignal= null; + fStartSignal_cond = null; } } // Wait for a selection event to occur. - fMutex.wait(); + fMutex_cond.wait(); while (true) { fIsReset= false; // Delay before showing the popup. - fMutex.wait(fDelay); + fMutex_cond.wait(fDelay); if (!fIsReset) break; } @@ -211,7 +218,7 @@ if (fProposalTable !is null && !fProposalTable.isDisposed() && fProposalTable.isVisible()) { synchronized (fMutex) { fIsReset= true; - fMutex.notifyAll(); + fMutex_cond.notifyAll(); } } }