Mercurial > projects > dwt-addons
diff dwtx/jface/text/contentassist/AdditionalInfoController.d @ 170:284c2e810329
compile of JFace.Text is ok now
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 09 Sep 2008 18:46:06 +0200 |
parents | cef27f663573 |
children |
line wrap: on
line diff
--- a/dwtx/jface/text/contentassist/AdditionalInfoController.d Tue Sep 09 17:44:33 2008 +0200 +++ b/dwtx/jface/text/contentassist/AdditionalInfoController.d Tue Sep 09 18:46:06 2008 +0200 @@ -46,6 +46,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; @@ -77,12 +79,35 @@ */ class AdditionalInfoController : AbstractInformationControlManager { + alias AbstractInformationControlManager.showInformation showInformation; + /** * A timer thread. * * @since 3.2 */ - private static abstract class Timer { + private static abstract class Timer : Object.Monitor { + + private Mutex fMutex; + private Condition fMutex_cond; + + public override void lock(){ + fMutex.lock(); + } + public override void unlock(){ + fMutex.unlock(); + } + public void notifyAll(){ + fMutex_cond.notifyAll(); + } + public void wait(){ + fMutex_cond.wait(); + } + public void wait( long delay ){ + fMutex_cond.wait(delay/1000.0); + } + + private static const int DELAY_UNTIL_JOB_IS_SCHEDULED= 50; /** @@ -280,6 +305,9 @@ * @param delay the delay until to show additional info */ public this(Display display, int delay) { + fMutex = new Mutex(); + fMutex_cond = new Condition(fMutex); + // DWT instance init IDLE_init(); FIRST_WAIT_init(); @@ -293,7 +321,7 @@ schedule(IDLE, current); fThread= new JThread( &threadrun ); - fThread.serName( JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ + fThread.setName( JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ fThread.start(); } void threadrun() { @@ -370,7 +398,7 @@ } private bool isExt5(ICompletionProposal p) { - return cast(ICompletionProposalExtension5)p; + return null !is cast(ICompletionProposalExtension5)p; } ICompletionProposal getCurrentProposal() { @@ -378,7 +406,7 @@ } ICompletionProposalExtension5 getCurrentProposalEx() { - Assert.isTrue( cast(ICompletionProposalExtension5)fCurrentProposal ); + Assert.isTrue( null !is cast(ICompletionProposalExtension5)fCurrentProposal ); return cast(ICompletionProposalExtension5) fCurrentProposal; } @@ -511,12 +539,15 @@ super.install(control.getShell()); - Assert.isTrue( cast(Table)control ); + Assert.isTrue( null !is cast(Table)control ); fProposalTable= cast(Table) control; fProposalTable.addSelectionListener(fSelectionListener); getInternalAccessor().getInformationControlReplacer().install(fProposalTable); fTimer= new class(fProposalTable.getDisplay(), fDelay) Timer { + this( Display d, int del ){ + super(d,del); + } protected void showInformation(ICompletionProposal proposal, Object info) { InformationControlReplacer replacer= getInternalAccessor().getInformationControlReplacer(); if (replacer !is null) @@ -571,7 +602,7 @@ if (fProposalTable is null || fProposalTable.isDisposed()) return; - if (fProposal is proposal && ((info is null && fInformation is null) || (info !is null && info.equals(fInformation)))) + if (fProposal is proposal && ((info is null && fInformation is null) || (info !is null && info.opEquals(fInformation)))) return; fInformation= info;