Mercurial > projects > dwt-addons
diff dwtx/jface/text/contentassist/AdditionalInfoController.d @ 140:26688fec6d23
Following dsss compile errors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 03:23:46 +0200 |
parents | 93a6ec48fd28 |
children | 75302ef3f92f |
line wrap: on
line diff
--- a/dwtx/jface/text/contentassist/AdditionalInfoController.d Sun Aug 24 02:31:41 2008 +0200 +++ b/dwtx/jface/text/contentassist/AdditionalInfoController.d Sun Aug 24 03:23:46 2008 +0200 @@ -79,15 +79,15 @@ * @since 2.0 */ class AdditionalInfoController : AbstractInformationControlManager { - + /** * A timer thread. - * + * * @since 3.2 */ private static abstract class Timer { private static final int DELAY_UNTIL_JOB_IS_SCHEDULED= 50; - + /** * A <code>Task</code> is {@link Task#run() run} when {@link #delay()} milliseconds have * elapsed after it was scheduled without a {@link #reset(ICompletionProposal) reset} @@ -107,7 +107,7 @@ */ public abstract Task nextTask(); } - + /** * IDLE: the initial task, and active whenever the info has been shown. It cannot be run, * but specifies an infinite delay. @@ -116,16 +116,16 @@ public void run() { Assert.isTrue(false); } - + public Task nextTask() { Assert.isTrue(false); return null; } - + public long delay() { return Long.MAX_VALUE; } - + public String toString() { return "IDLE"; //$NON-NLS-1$ } @@ -136,7 +136,10 @@ private final Task FIRST_WAIT= new class() Task { public void run() { final ICompletionProposalExtension5 proposal= getCurrentProposalEx(); - Job job= new Job(JFaceTextMessages.getString("AdditionalInfoController.job_name")) { //$NON-NLS-1$ + Job job= new class(JFaceTextMessages.getString("AdditionalInfoController.job_name")) Job { //$NON-NLS-1$ + this( String txt ){ + super( txt ); + } protected IStatus run(IProgressMonitor monitor) { Object info; try { @@ -154,15 +157,15 @@ }; job.schedule(); } - + public Task nextTask() { return SECOND_WAIT; } - + public long delay() { return DELAY_UNTIL_JOB_IS_SCHEDULED; } - + public String toString() { return "FIRST_WAIT"; //$NON-NLS-1$ } @@ -176,15 +179,15 @@ // show the info allowShowing(); } - + public Task nextTask() { return IDLE; } - + public long delay() { return fDelay - DELAY_UNTIL_JOB_IS_SCHEDULED; } - + public String toString() { return "SECOND_WAIT"; //$NON-NLS-1$ } @@ -198,7 +201,7 @@ if (!fDisplay.isDisposed()) { fDisplay.asyncExec(new class() Runnable { public void run() { - synchronized (Timer.this) { + synchronized (this.outer) { if (proposal is getCurrentProposal()) { Object info= proposal.getAdditionalProposalInfo(); showInformation(proposal, info); @@ -208,15 +211,15 @@ }); } } - + public Task nextTask() { return IDLE; } - + public long delay() { return fDelay; } - + public String toString() { return "LEGACY_WAIT"; //$NON-NLS-1$ } @@ -237,12 +240,12 @@ public void run() { Assert.isTrue(false); } - + public String toString() { return "EXIT"; //$NON-NLS-1$ } }; - + /** The timer thread. */ private final Thread fThread; @@ -250,17 +253,17 @@ private Task fTask; /** The next wake up time. */ private long fNextWakeup; - + private ICompletionProposal fCurrentProposal= null; private Object fCurrentInfo= null; private bool fAllowShowing= false; private final Display fDisplay; private final int fDelay; - + /** * Creates a new timer. - * + * * @param display the display to use for display thread posting. * @param delay the delay until to show additional info */ @@ -270,17 +273,17 @@ long current= System.currentTimeMillis(); schedule(IDLE, current); - fThread= new class(new Runnable() Thread { - public void run() { - try { - loop(); - } catch (InterruptedException x) { - } + void threadrun() { + try { + loop(); + } catch (InterruptedException x) { } - }, JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ + } + fThread= new Thread( &threadrun ); + fThread.name = JFaceTextMessages.getString("InfoPopup.info_delay_timer_name"); //$NON-NLS-1$ fThread.start(); } - + /** * Terminates the timer thread. */ @@ -288,10 +291,10 @@ schedule(EXIT, System.currentTimeMillis()); notifyAll(); } - + /** * Resets the timer thread as the selection has changed to a new proposal. - * + * * @param p the new proposal */ public final synchronized void reset(ICompletionProposal p) { @@ -307,7 +310,7 @@ notifyAll(); } } - + private Task taskOnReset(ICompletionProposal p) { if (p is null) return IDLE; @@ -333,11 +336,11 @@ } } } - + private Task currentTask() { return fTask; } - + private void schedule(Task task, long current) { fTask= task; long nextWakeup= current + task.delay(); @@ -354,7 +357,7 @@ ICompletionProposal getCurrentProposal() { return fCurrentProposal; } - + ICompletionProposalExtension5 getCurrentProposalEx() { Assert.isTrue( cast(ICompletionProposalExtension5)fCurrentProposal ); return cast(ICompletionProposalExtension5) fCurrentProposal; @@ -374,7 +377,7 @@ if (!fDisplay.isDisposed()) { fDisplay.asyncExec(new class() Runnable { public void run() { - synchronized (Timer.this) { + synchronized (this.outer) { if (info is fCurrentInfo) { showInformation(fCurrentProposal, info); } @@ -383,10 +386,10 @@ }); } } - + /** * Called in the display thread to show additional info. - * + * * @param proposal the proposal to show information about * @param info the information about <code>proposal</code> */ @@ -415,7 +418,7 @@ public void widgetDefaultSelected(SelectionEvent e) { } } - + /** * Default control creator for the information control replacer. * @since 3.4 @@ -460,8 +463,8 @@ super(creator); fDelay= delay; setAnchor(ANCHOR_RIGHT); - setFallbackAnchors(new Anchor[] { ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM }); - + setFallbackAnchors([ ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM ]); + /* * Adjust the location by one pixel towards the proposal popup, so that the single pixel * border of the additional info popup overlays with the border of the popup. This avoids @@ -469,7 +472,7 @@ */ int spacing= -1; setMargins(spacing, spacing); // see also adjustment in #computeLocation - + InformationControlReplacer replacer= new InformationControlReplacer(new DefaultPresenterControlCreator()); getInternalAccessor().setInformationControlReplacer(replacer); } @@ -490,7 +493,7 @@ fProposalTable= cast(Table) control; fProposalTable.addSelectionListener(fSelectionListener); getInternalAccessor().getInformationControlReplacer().install(fProposalTable); - + fTimer= new class(fProposalTable.getDisplay(), fDelay) Timer { protected void showInformation(ICompletionProposal proposal, Object info) { InformationControlReplacer replacer= getInternalAccessor().getInformationControlReplacer(); @@ -545,10 +548,10 @@ void showInformation(ICompletionProposal proposal, Object info) { if (fProposalTable is null || fProposalTable.isDisposed()) return; - + if (fProposal is proposal && ((info is null && fInformation is null) || (info !is null && info.equals(fInformation)))) return; - + fInformation= info; fProposal= proposal; showInformation(); @@ -575,7 +578,7 @@ */ protected Point computeLocation(Rectangle subjectArea, Point controlSize, Anchor anchor) { Point location= super.computeLocation(subjectArea, controlSize, anchor); - + /* * The location is computed using subjectControl.toDisplay(), which does not include the * trim of the subject control. As we want the additional info popup aligned with the outer @@ -595,7 +598,7 @@ // at least as big as the proposal table Point sizeConstraint= super.computeSizeConstraints(subjectControl, informationControl); Point size= subjectControl.getShell().getSize(); - + // AbstractInformationControlManager#internalShowInformationControl(Rectangle, Object) adds trims // to the computed constraints. Need to remove them here, to make the outer bounds of the additional // info shell fit the bounds of the proposal shell: @@ -611,7 +614,7 @@ sizeConstraint.y= size.y; return sizeConstraint; } - + /* * @see dwtx.jface.text.AbstractInformationControlManager#hideInformationControl() */