# HG changeset patch # User Frank Benoit # Date 1219683826 -7200 # Node ID a9566845f1cbbc47414a55388e2547fb161e90ab # Parent 8442b6b2da2d020045181933a127c32c6afaa3c3 ... diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/internal/text/InformationControlReplacer.d --- a/dwtx/jface/internal/text/InformationControlReplacer.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/internal/text/InformationControlReplacer.d Mon Aug 25 19:03:46 2008 +0200 @@ -89,7 +89,7 @@ * @param subjectArea the subject area * @param takeFocus true iff the replacing information control should take focus */ - public void replaceInformationControl(IInformationControlCreator informationPresenterControlCreator, Rectangle contentBounds, Object information, final Rectangle subjectArea, bool takeFocus) { + public void replaceInformationControl(IInformationControlCreator informationPresenterControlCreator, Rectangle contentBounds, Object information, Rectangle subjectArea, bool takeFocus) { try { fIsReplacing= true; diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/internal/text/InternalAccessor.d --- a/dwtx/jface/internal/text/InternalAccessor.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/internal/text/InternalAccessor.d Mon Aug 25 19:03:46 2008 +0200 @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: @@ -28,20 +28,20 @@ import dwtx.jface.text.IInformationControl; import dwtx.jface.text.IInformationControlExtension3; import dwtx.jface.text.ITextViewerExtension8; -import dwtx.jface.text.ITextViewerExtension8.EnrichMode; +import dwtx.jface.text.ITextViewerExtension8; /** * An internal class that gives access to internal methods of {@link * AbstractInformationControlManager} and subclasses. - * + * * @since 3.4 */ public abstract class InternalAccessor { /** * Returns the current information control, or null if none. - * + * * @return the current information control, or null if none */ public abstract IInformationControl getCurrentInformationControl(); @@ -49,7 +49,7 @@ /** * Sets the information control replacer for this manager and disposes the * old one if set. - * + * * @param replacer the information control replacer for this manager, or * null if no information control replacing should * take place @@ -58,38 +58,38 @@ /** * Returns the current information control replacer or null if none has been installed. - * + * * @return the current information control replacer or null if none has been installed */ public abstract InformationControlReplacer getInformationControlReplacer(); - + /** * Tests whether the given information control is replaceable. - * + * * @param iControl information control or null if none * @return true if information control is replaceable, false otherwise */ public abstract bool canReplace(IInformationControl iControl); - + /** * Tells whether this manager's information control is currently being replaced. - * + * * @return true if a replace is in progress */ public abstract bool isReplaceInProgress(); - + /** * Crops the given bounds such that they lie completely on the closest monitor. - * + * * @param bounds shell bounds to crop */ public abstract void cropToClosestMonitor(Rectangle bounds); - + /** * Sets the hover enrich mode. Only applicable when an information * control replacer has been set with * {@link #setInformationControlReplacer(InformationControlReplacer)} . - * + * * @param mode the enrich mode * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode) */ @@ -97,18 +97,18 @@ /** * Indicates whether the mouse cursor is allowed to leave the subject area without closing the hover. - * + * * @return whether the mouse cursor is allowed to leave the subject area without closing the hover */ public abstract bool getAllowMouseExit(); - + /** * Replaces this manager's information control as defined by * the information control replacer. * Must only be called when the information control is instanceof {@link IInformationControlExtension3}! - * + * * @param takeFocus true iff the replacing information control should take focus */ public abstract void replaceInformationControl(bool takeFocus); - + } diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/internal/text/TableOwnerDrawSupport.d --- a/dwtx/jface/internal/text/TableOwnerDrawSupport.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/internal/text/TableOwnerDrawSupport.d Mon Aug 25 19:03:46 2008 +0200 @@ -36,13 +36,13 @@ /** * Adds owner draw support for tables. - * + * * @since 3.4 */ public class TableOwnerDrawSupport : Listener { - + private static const String STYLED_RANGES_KEY= "styled_ranges"; //$NON-NLS-1$ - + private TextLayout fLayout; public static void install(Table table) { @@ -52,10 +52,10 @@ table.addListener(DWT.EraseItem, listener); table.addListener(DWT.PaintItem, listener); } - + /** * Stores the styled ranges in the given table item. - * + * * @param item table item * @param column the column index * @param ranges the styled ranges or null to remove them @@ -63,16 +63,16 @@ public static void storeStyleRanges(TableItem item, int column, StyleRange[] ranges) { item.setData(STYLED_RANGES_KEY + column, ranges); } - + /** * Returns the styled ranges which are stored in the given table item. - * + * * @param item table item * @param column the column index * @return the styled ranges */ private static StyleRange[] getStyledRanges(TableItem item, int column) { - return (StyleRange[])item.getData(STYLED_RANGES_KEY + column); + return arraycast!(StyleRange)(item.getData(STYLED_RANGES_KEY + column)); } private this(Table table) { @@ -102,28 +102,28 @@ /** * Performs the paint operation. - * + * * @param event the event */ private void performPaint(Event event) { TableItem item= cast(TableItem) event.item; GC gc= event.gc; int index= event.index; - + bool isSelected= (event.detail & DWT.SELECTED) !is 0; - + // Remember colors to restore the GC later Color oldForeground= gc.getForeground(); Color oldBackground= gc.getBackground(); - + if (!isSelected) { Color foreground= item.getForeground(index); gc.setForeground(foreground); - + Color background= item.getBackground(index); gc.setBackground(background); } - + Image image=item.getImage(index); if (image !is null) { Rectangle imageBounds=item.getImageBounds(index); @@ -132,14 +132,14 @@ int y=imageBounds.y + Math.max(0, (imageBounds.height - bounds.height) / 2); gc.drawImage(image, x, y); } - + fLayout.setFont(item.getFont(index)); - + // XXX: needed to clear the style info, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226090 fLayout.setText(""); //$NON-NLS-1$ - + fLayout.setText(item.getText(index)); - + StyleRange[] ranges= getStyledRanges(item, index); if (ranges !is null) { for (int i= 0; i < ranges.length; i++) { @@ -152,7 +152,7 @@ fLayout.setStyle(curr, curr.start, curr.start + curr.length - 1); } } - + Rectangle textBounds=item.getTextBounds(index); if (textBounds !is null) { Rectangle layoutBounds=fLayout.getBounds(); @@ -160,20 +160,20 @@ int y=textBounds.y + Math.max(0, (textBounds.height - layoutBounds.height) / 2); fLayout.draw(gc, x, y); } - + if ((event.detail & DWT.FOCUSED) !is 0) { Rectangle focusBounds=item.getBounds(); gc.drawFocus(focusBounds.x, focusBounds.y, focusBounds.width, focusBounds.height); } - + if (!isSelected) { gc.setForeground(oldForeground); gc.setBackground(oldBackground); } } - + private void widgetDisposed() { fLayout.dispose(); } } - + diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/AbstractHoverInformationControlManager.d --- a/dwtx/jface/text/AbstractHoverInformationControlManager.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/AbstractHoverInformationControlManager.d Mon Aug 25 19:03:46 2008 +0200 @@ -188,7 +188,7 @@ import dwtx.jface.internal.text.DelayedInputChangeListener; import dwtx.jface.internal.text.InformationControlReplacer; import dwtx.jface.internal.text.InternalAccessor; -import dwtx.jface.text.ITextViewerExtension8.EnrichMode; +import dwtx.jface.text.ITextViewerExtension8; import dwtx.jface.text.source.AnnotationBarHoverManager; import dwtx.jface.util.Geometry; @@ -982,7 +982,7 @@ * @param display the display to be used for the call to * {@link #replaceInformationControl(bool)} in the UI thread */ - private void startReplaceInformationControl(final Display display) { + private void startReplaceInformationControl(Display display) { if (fEnrichMode is EnrichMode.ON_CLICK) return; @@ -1003,15 +1003,17 @@ return; } - fReplacingDelayJob= new class("AbstractHoverInformationControlManager Replace Delayer") Job { //$NON-NLS-1$ - this( String str ){ + fReplacingDelayJob= new class("AbstractHoverInformationControlManager Replace Delayer", display) Job { //$NON-NLS-1$ + Display display_; + this( String str, Display b){ super(str); + display_=b; } public IStatus run(IProgressMonitor monitor) { - if (monitor.isCanceled() || display.isDisposed()) { + if (monitor.isCanceled() || display_.isDisposed()) { return Status.CANCEL_STATUS; } - display.syncExec(dgRunnable( (IProgressMonitor monitor_) { + display_.syncExec(dgRunnable( (IProgressMonitor monitor_) { fReplacingDelayJob= null; if (monitor_.isCanceled()) return; diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/AbstractInformationControl.d --- a/dwtx/jface/text/AbstractInformationControl.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/AbstractInformationControl.d Mon Aug 25 19:03:46 2008 +0200 @@ -304,7 +304,7 @@ * * @deprecated clients should use one of the public constructors */ - this(Shell parentShell, int shellStyle, final String statusFieldText, final ToolBarManager toolBarManager) { + this(Shell parentShell, int shellStyle, String statusFieldText, ToolBarManager toolBarManager) { Assert.isTrue(statusFieldText is null || toolBarManager is null); fResizeHandleSize= -1; fToolBarManager= toolBarManager; @@ -333,7 +333,7 @@ createStatusComposite(statusFieldText, toolBarManager, foreground, background); } - private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager, Color foreground, Color background) { + private void createStatusComposite(String statusFieldText, ToolBarManager toolBarManager, Color foreground, Color background) { if (toolBarManager is null && statusFieldText is null) return; @@ -356,7 +356,7 @@ } } - private void createStatusLabel(final String statusFieldText, Color foreground, Color background) { + private void createStatusLabel(String statusFieldText, Color foreground, Color background) { fStatusLabel= new Label(fStatusComposite, DWT.RIGHT); fStatusLabel.setLayoutData(new GridData(DWT.FILL, DWT.CENTER, true, false)); fStatusLabel.setText(statusFieldText); @@ -373,7 +373,7 @@ } private void createToolBar(ToolBarManager toolBarManager) { - final Composite bars= new Composite(fStatusComposite, DWT.NONE); + Composite bars= new Composite(fStatusComposite, DWT.NONE); bars.setLayoutData(new GridData(DWT.FILL, DWT.FILL, false, false)); GridLayout layout= new GridLayout(3, false); @@ -397,16 +397,16 @@ addResizeSupportIfNecessary(bars); } - private void addResizeSupportIfNecessary(final Composite bars) { + private void addResizeSupportIfNecessary(Composite bars) { // XXX: workarounds for // - https://bugs.eclipse.org/bugs/show_bug.cgi?id=219139 : API to add resize grip / grow box in lower right corner of shell // - https://bugs.eclipse.org/bugs/show_bug.cgi?id=23980 : platform specific shell resize behavior String platform= DWT.getPlatform(); - final bool isWin= platform.equals("win32"); //$NON-NLS-1$ + bool isWin= platform.equals("win32"); //$NON-NLS-1$ if (!isWin && !platform.equals("gtk")) //$NON-NLS-1$ return; - final Canvas resizer= new Canvas(bars, DWT.NONE); + Canvas resizer= new Canvas(bars, DWT.NONE); int size= getResizeHandleSize(bars); @@ -414,32 +414,38 @@ data.widthHint= size; data.heightHint= size; resizer.setLayoutData(data); - resizer.addPaintListener(new class() PaintListener { + resizer.addPaintListener(new class(isWin,resizer) PaintListener { + bool isWin_; + Canvas resizer_; + this(bool a, Canvas b ){ + isWin_=a; + resizer_=b; + } public void paintControl(PaintEvent e) { - Point s= resizer.getSize(); + Point s= resizer_.getSize(); int x= s.x - 2; int y= s.y - 2; int min= Math.min(x, y); - if (isWin) { + if (isWin_) { // draw dots - e.gc.setBackground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + e.gc.setBackground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); int end= min - 1; for (int i= 0; i <= 2; i++) for (int j= 0; j <= 2 - i; j++) e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2); end--; - e.gc.setBackground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); + e.gc.setBackground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); for (int i= 0; i <= 2; i++) for (int j= 0; j <= 2 - i; j++) e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2); } else { // draw diagonal lines - e.gc.setForeground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); + e.gc.setForeground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); for (int i= 1; i < min; i+= 4) { e.gc.drawLine(i, y, x, i); } - e.gc.setForeground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + e.gc.setForeground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); for (int i= 2; i < min; i+= 4) { e.gc.drawLine(i, y, x, i); } @@ -448,29 +454,43 @@ }); resizer.setCursor(new Cursor(resizer.getDisplay(), DWT.CURSOR_SIZESE)); - MouseAdapter resizeSupport= new class() MouseAdapter { + MouseAdapter resizeSupport= new class(resizer) MouseAdapter { + Canvas resizer_; + this(Canvas a){ + resizer_=a; + } private MouseMoveListener fResizeListener; public void mouseDown(MouseEvent e) { Point shellSize= fShell.getSize(); - final int shellX= shellSize.x; - final int shellY= shellSize.y; - Point mouseLoc= resizer.toDisplay(e.x, e.y); - final int mouseX= mouseLoc.x; - final int mouseY= mouseLoc.y; - fResizeListener= new class() MouseMoveListener { + int shellX= shellSize.x; + int shellY= shellSize.y; + Point mouseLoc= resizer_.toDisplay(e.x, e.y); + int mouseX= mouseLoc.x; + int mouseY= mouseLoc.y; + fResizeListener= new class(shellX,shellY,mouseX,mouseY) MouseMoveListener { + int shellX_; + int shellY_; + int mouseX_; + int mouseY_; + this(int a, int b, int c, int d ){ + shellX_=a; + shellY_=b; + mouseX_=c; + mouseY_=d; + } public void mouseMove(MouseEvent e2) { - Point mouseLoc2= resizer.toDisplay(e2.x, e2.y); - int dx= mouseLoc2.x - mouseX; - int dy= mouseLoc2.y - mouseY; - setSize(shellX + dx, shellY + dy); + Point mouseLoc2= resizer_.toDisplay(e2.x, e2.y); + int dx= mouseLoc2.x - mouseX_; + int dy= mouseLoc2.y - mouseY_; + setSize(shellX_ + dx, shellY_ + dy); } }; - resizer.addMouseMoveListener(fResizeListener); + resizer_.addMouseMoveListener(fResizeListener); } public void mouseUp(MouseEvent e) { - resizer.removeMouseMoveListener(fResizeListener); + resizer_.removeMouseMoveListener(fResizeListener); fResizeListener= null; } }; @@ -496,30 +516,33 @@ * * @param control the control that can be used to move the shell */ - private void addMoveSupport(final Control control) { - MouseAdapter moveSupport= new class() MouseAdapter { + private void addMoveSupport(Control control) { + MouseAdapter moveSupport= new class(control) MouseAdapter { private MouseMoveListener fMoveListener; - + Control control_; + this(Control a){ + control_=a; + } public void mouseDown(MouseEvent e) { Point shellLoc= fShell.getLocation(); final int shellX= shellLoc.x; final int shellY= shellLoc.y; - Point mouseLoc= control.toDisplay(e.x, e.y); + Point mouseLoc= control_.toDisplay(e.x, e.y); final int mouseX= mouseLoc.x; final int mouseY= mouseLoc.y; fMoveListener= new class() MouseMoveListener { public void mouseMove(MouseEvent e2) { - Point mouseLoc2= control.toDisplay(e2.x, e2.y); + Point mouseLoc2= control_.toDisplay(e2.x, e2.y); int dx= mouseLoc2.x - mouseX; int dy= mouseLoc2.y - mouseY; fShell.setLocation(shellX + dx, shellY + dy); } }; - control.addMouseMoveListener(fMoveListener); + control_.addMouseMoveListener(fMoveListener); } public void mouseUp(MouseEvent e) { - control.removeMouseMoveListener(fMoveListener); + control_.removeMouseMoveListener(fMoveListener); fMoveListener= null; } }; @@ -769,7 +792,7 @@ * {@inheritDoc} * This method is not intended to be overridden by subclasses. */ - public void addFocusListener(final FocusListener listener) { + public void addFocusListener(FocusListener listener) { if (fFocusListeners.isEmpty()) { fShellListener= new class() Listener { diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/AbstractInformationControlManager.d --- a/dwtx/jface/text/AbstractInformationControlManager.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/AbstractInformationControlManager.d Mon Aug 25 19:03:46 2008 +0200 @@ -176,7 +176,7 @@ import dwtx.jface.dialogs.IDialogSettings; import dwtx.jface.internal.text.InformationControlReplacer; import dwtx.jface.internal.text.InternalAccessor; -import dwtx.jface.text.ITextViewerExtension8.EnrichMode; +import dwtx.jface.text.ITextViewerExtension8; import dwtx.jface.util.Geometry; @@ -465,7 +465,7 @@ * The custom information control creator. * @since 3.0 */ - private volatile IInformationControlCreator fCustomInformationControlCreator; + private /+volatile+/ IInformationControlCreator fCustomInformationControlCreator; /** * Tells whether a custom information control is in use. diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/DefaultInformationControl.d --- a/dwtx/jface/text/DefaultInformationControl.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/DefaultInformationControl.d Mon Aug 25 19:03:46 2008 +0200 @@ -213,17 +213,17 @@ */ String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight); } - - + + /** * An information presenter determines the style presentation * of information displayed in the default information control. * The interface can be implemented by clients. - * + * * @since 3.2 */ public interface IInformationPresenterExtension { - + /** * Updates the given presentation of the given information and * thereby may manipulate the information to be displayed. The manipulation @@ -245,7 +245,7 @@ */ String updatePresentation(Drawable drawable, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight); } - + /** * Inner border thickness in pixels. @@ -259,7 +259,7 @@ private const IInformationPresenter fPresenter; /** A cached text presentation */ private const TextPresentation fPresentation= new TextPresentation(); - + /** * Additional styles to use for the text control. * @since 3.4, previously called fTextStyle @@ -269,7 +269,7 @@ /** * Creates a default information control with the given shell as parent. An information * presenter that can handle simple HTML is used to process the information to be displayed. - * + * * @param parent the parent shell * @param isResizeable true if the control should be resizable * @since 3.4 @@ -284,7 +284,7 @@ /** * Creates a default information control with the given shell as parent. An information * presenter that can handle simple HTML is used to process the information to be displayed. - * + * * @param parent the parent shell * @param statusFieldText the text to be used in the status field or null to hide the status field * @since 3.4 @@ -297,7 +297,7 @@ * Creates a default information control with the given shell as parent. The * given information presenter is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param statusFieldText the text to be used in the status field or null to hide the status field * @param presenter the presenter to be used, or null if no presenter should be used @@ -314,7 +314,7 @@ * Creates a resizable default information control with the given shell as parent. An * information presenter that can handle simple HTML is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param toolBarManager the manager or null if toolbar is not desired * @since 3.4 @@ -327,7 +327,7 @@ * Creates a resizable default information control with the given shell as * parent. The given information presenter is used to process the * information to be displayed. - * + * * @param parent the parent shell * @param toolBarManager the manager or null if toolbar is not desired * @param presenter the presenter to be used, or null if no presenter should be used @@ -367,7 +367,7 @@ * given information presenter is used to process the information to be * displayed. The given styles are applied to the created styled text * widget. - * + * * @param parent the parent shell * @param shellStyle the additional styles for the shell * @param style the additional styles for the styled text widget @@ -383,7 +383,7 @@ * given information presenter is used to process the information to be * displayed. The given styles are applied to the created styled text * widget. - * + * * @param parentShell the parent shell * @param shellStyle the additional styles for the shell * @param style the additional styles for the styled text widget @@ -392,7 +392,7 @@ * @since 3.0 * @deprecated As of 3.4, replaced by simpler constructors */ - public this(Shell parentShell, int shellStyle, final int style, IInformationPresenter presenter, String statusFieldText) { + public this(Shell parentShell, int shellStyle, int style, IInformationPresenter presenter, String statusFieldText) { super(parentShell, DWT.NO_FOCUS | DWT.ON_TOP | shellStyle, statusFieldText, null); fAdditionalTextStyles= style; fPresenter= presenter; @@ -403,7 +403,7 @@ * Creates a default information control with the given shell as parent. The * given information presenter is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param textStyles the additional styles for the styled text widget * @param presenter the presenter to be used @@ -417,7 +417,7 @@ * Creates a default information control with the given shell as parent. The * given information presenter is used to process the information to be * displayed. - * + * * @param parent the parent shell * @param textStyles the additional styles for the styled text widget * @param presenter the presenter to be used @@ -442,14 +442,14 @@ fText.setFont(JFaceResources.getDialogFont()); FillLayout layout= cast(FillLayout)parent.getLayout(); if (fText.getWordWrap()) { - // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432 + // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432 layout.marginHeight= INNER_BORDER; layout.marginWidth= INNER_BORDER; } else { fText.setIndent(INNER_BORDER); } } - + /* * @see IInformationControl#setInformation(String) */ @@ -458,7 +458,7 @@ fText.setText(content); } else { fPresentation.clear(); - + int maxWidth= -1; int maxHeight= -1; Point constraints= getSizeConstraints(); @@ -478,7 +478,7 @@ } if (isResizable()) maxHeight= Integer.MAX_VALUE; - + if ( cast(IInformationPresenterExtension)fPresenter ) content= (cast(IInformationPresenterExtension)fPresenter).updatePresentation(fText, content, fPresentation, maxWidth, maxHeight); else @@ -506,7 +506,7 @@ setSize(currentSize.x, currentSize.y); // restore previous size } } - + super.setVisible(visible); } @@ -519,10 +519,10 @@ Point constraints= getSizeConstraints(); if (constraints !is null && fText.getWordWrap()) widthHint= constraints.x; - + return getShell().computeSize(widthHint, DWT.DEFAULT, true); } - + /* * @see dwtx.jface.text.AbstractInformationControl#computeTrim() */ @@ -575,5 +575,5 @@ } }; } - + } diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/DefaultUndoManager.d --- a/dwtx/jface/text/DefaultUndoManager.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/DefaultUndoManager.d Mon Aug 25 19:03:46 2008 +0200 @@ -875,37 +875,35 @@ class HistoryListener : IOperationHistoryListener { private IUndoableOperation fOperation; - public void historyNotification(final OperationHistoryEvent event) { - final int type= event.getEventType(); + public void historyNotification(OperationHistoryEvent event) { + int type= event.getEventType(); switch (type) { case OperationHistoryEvent.ABOUT_TO_UNDO: case OperationHistoryEvent.ABOUT_TO_REDO: // if this is one of our operations if (event.getOperation().hasContext(fUndoContext)) { - fTextViewer.getTextWidget().getDisplay().syncExec(new class() Runnable { - public void run() { - // if we are undoing/redoing a command we generated, then ignore - // the document changes associated with this undo or redo. - if (cast(TextCommand)event.getOperation() ) { - if ( cast(TextViewer)fTextViewer ) - (cast(TextViewer)fTextViewer).ignoreAutoEditStrategies(true); - listenToTextChanges(false); + fTextViewer.getTextWidget().getDisplay().syncExec(dgRunnable((Event event_, int type_ ) { + // if we are undoing/redoing a command we generated, then ignore + // the document changes associated with this undo or redo. + if (cast(TextCommand)event_.getOperation() ) { + if ( cast(TextViewer)fTextViewer ) + (cast(TextViewer)fTextViewer).ignoreAutoEditStrategies(true); + listenToTextChanges(false); - // in the undo case only, make sure compounds are closed - if (type is OperationHistoryEvent.ABOUT_TO_UNDO) { - if (fFoldingIntoCompoundChange) { - endCompoundChange(); - } + // in the undo case only, make sure compounds are closed + if (type_ is OperationHistoryEvent.ABOUT_TO_UNDO) { + if (fFoldingIntoCompoundChange) { + endCompoundChange(); } - } else { - // the undo or redo has our context, but it is not one of - // our commands. We will listen to the changes, but will - // reset the state that tracks the undo/redo history. - commit(); - fLastAddedCommand= null; } + } else { + // the undo or redo has our context, but it is not one of + // our commands. We will listen to the changes, but will + // reset the state that tracks the undo/redo history. + commit(); + fLastAddedCommand= null; } - }); + }, event, type )); fOperation= event.getOperation(); } break; @@ -1321,7 +1319,7 @@ * @param ex the exception * @since 3.1 */ - private void openErrorDialog(final String title, final Exception ex) { + private void openErrorDialog(String title, Exception ex) { Shell shell= null; if (isConnected()) { StyledText st= fTextViewer.getTextWidget(); @@ -1332,16 +1330,14 @@ MessageDialog.openError(shell, title, ex.getLocalizedMessage()); else { Display display; - final Shell finalShell= shell; + Shell finalShell= shell; if (finalShell !is null) display= finalShell.getDisplay(); else display= Display.getDefault(); - display.syncExec(new class() Runnable { - public void run() { - MessageDialog.openError(finalShell, title, ex.getLocalizedMessage()); - } - }); + display.syncExec(dgRunnable( { + MessageDialog.openError(finalShell, title, ex.getLocalizedMessage()); + })); } } diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/DocumentCommand.d --- a/dwtx/jface/text/DocumentCommand.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/DocumentCommand.d Mon Aug 25 19:03:46 2008 +0200 @@ -244,7 +244,7 @@ /* * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ - public int compareTo(final Object object) { + public int compareTo(Object object) { if (isEqual(object)) return 0; @@ -331,7 +331,7 @@ * @param command the original command * @param forward the direction */ - public this(final List commands, final Command command, final bool forward) { + public this(List commands, Command command, bool forward) { if (commands is null || command is null) throw new IllegalArgumentException(); fIterator= forward ? commands.iterator() : new ReverseListIterator(commands.listIterator(commands.size())); diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/FindReplaceDocumentAdapter.d --- a/dwtx/jface/text/FindReplaceDocumentAdapter.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/FindReplaceDocumentAdapter.d Mon Aug 25 19:03:46 2008 +0200 @@ -283,7 +283,7 @@ * @throws IllegalStateException if a REPLACE or REPLACE_FIND operation is not preceded by a successful FIND operation * @throws PatternSyntaxException if a regular expression has invalid syntax */ - private IRegion findReplace(final FindReplaceOperationCode operationCode, int startOffset, String findString, String replaceText, bool forwardSearch, bool caseSensitive, bool wholeWord, bool regExSearch) { + private IRegion findReplace(FindReplaceOperationCode operationCode, int startOffset, String findString, String replaceText, bool forwardSearch, bool caseSensitive, bool wholeWord, bool regExSearch) { // Validate option combinations Assert.isTrue(!(regExSearch && wholeWord)); @@ -573,7 +573,7 @@ * @return the new offset * @since 3.4 */ - private int interpretReplaceEscape(final char ch, int i, StringBuffer buf, String replaceText, String foundText) { + private int interpretReplaceEscape(char ch, int i, StringBuffer buf, String replaceText, String foundText) { int length= replaceText.length(); switch (ch) { case 'r': diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/FindReplaceDocumentAdapterContentProposalProvider.d --- a/dwtx/jface/text/FindReplaceDocumentAdapterContentProposalProvider.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/FindReplaceDocumentAdapterContentProposalProvider.d Mon Aug 25 19:03:46 2008 +0200 @@ -373,7 +373,7 @@ } fPriorityProposals.addAll(fProposals); - return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fProposals.size()]); + return arraycast!(IContentProposal)( fPriorityProposals.toArray()); } /** @@ -401,7 +401,7 @@ addBsProposal("\\C", RegExMessages.getString("displayString_replace_bs_C"), RegExMessages.getString("additionalInfo_replace_bs_C")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } fPriorityProposals.addAll(fProposals); - return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fPriorityProposals.size()]); + return arraycast!(IContentProposal)( fPriorityProposals.toArray()); } /** diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/GapTextStore.d --- a/dwtx/jface/text/GapTextStore.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/GapTextStore.d Mon Aug 25 19:03:46 2008 +0200 @@ -178,7 +178,7 @@ *

* This class is not intended to be subclassed. *

- * + * * @see CopyOnWriteTextStore for a copy-on-write text store wrapper * @noextend This class is not intended to be subclassed by clients. */ @@ -196,7 +196,7 @@ /** * The multiplier to compute the array size from the content length * (1 <= fSizeMultiplier <= 2). - * + * * @since 3.3 */ private const float fSizeMultiplier; @@ -216,7 +216,7 @@ /** * Creates a new empty text store using the specified low and high watermarks. - * + * * @param lowWatermark unused - at the lower bound, the array is only resized when the content * does not fit * @param highWatermark if the gap is ever larger than this, it will automatically be shrunken @@ -239,11 +239,11 @@ */ this(highWatermark / 2, highWatermark / 2, 0f); } - + /** * Equivalent to * {@linkplain GapTextStore#GapTextStore(int, int, float) new GapTextStore(256, 4096, 0.1f)}. - * + * * @since 3.3 */ public this() { @@ -268,7 +268,7 @@ * documents. Use maxSize to avoid a huge gap being allocated for large * documents. *

- * + * * @param minSize the minimum gap size to allocate (>= 0; use 0 for no minimum) * @param maxSize the maximum gap size to allocate (>= minSize; use * {@link Integer#MAX_VALUE} for no maximum) @@ -350,7 +350,7 @@ * offset + remove behind the gap. The gap size is kept between 0 and * {@link #fThreshold}, leading to re-allocation if needed. The content between * offset and offset + add is undefined after this operation. - * + * * @param offset the offset at which a change happens * @param remove the number of character which are removed or overwritten at offset * @param add the number of character which are inserted or overwriting at offset @@ -374,7 +374,7 @@ /** * Moves the gap to newGapStart. - * + * * @param offset the change offset * @param remove the number of removed / overwritten characters * @param oldGapSize the old gap size @@ -406,7 +406,7 @@ /** * Reallocates a new array and copies the data from the previous one. - * + * * @param offset the change offset * @param remove the number of removed / overwritten characters * @param oldGapSize the old gap size @@ -415,7 +415,7 @@ * @return the new gap end * @since 3.3 */ - private int reallocate(int offset, int remove, final int oldGapSize, int newGapSize, final int newGapStart) { + private int reallocate(int offset, int remove, int oldGapSize, int newGapSize, int newGapStart) { // the new content length (without any gap) final int newLength= fContent.length - newGapSize; // the new array size based on the gap factor @@ -476,7 +476,7 @@ /** * Allocates a new char[size]. - * + * * @param size the length of the new array. * @return a newly allocated char array * @since 3.3 @@ -497,7 +497,7 @@ /** * Returns the gap size. - * + * * @return the gap size * @since 3.3 */ diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/ITextViewerExtension8.d --- a/dwtx/jface/text/ITextViewerExtension8.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/ITextViewerExtension8.d Mon Aug 25 19:03:46 2008 +0200 @@ -12,148 +12,6 @@ *******************************************************************************/ module dwtx.jface.text.ITextViewerExtension8; -import dwtx.jface.text.IDocumentPartitioningListener; // packageimport -import dwtx.jface.text.DefaultTextHover; // packageimport -import dwtx.jface.text.AbstractInformationControl; // packageimport -import dwtx.jface.text.TextUtilities; // packageimport -import dwtx.jface.text.IInformationControlCreatorExtension; // packageimport -import dwtx.jface.text.AbstractInformationControlManager; // packageimport -import dwtx.jface.text.ITextViewerExtension2; // packageimport -import dwtx.jface.text.IDocumentPartitioner; // packageimport -import dwtx.jface.text.DefaultIndentLineAutoEditStrategy; // packageimport -import dwtx.jface.text.ITextSelection; // packageimport -import dwtx.jface.text.Document; // packageimport -import dwtx.jface.text.FindReplaceDocumentAdapterContentProposalProvider; // packageimport -import dwtx.jface.text.ITextListener; // packageimport -import dwtx.jface.text.BadPartitioningException; // packageimport -import dwtx.jface.text.ITextViewerExtension5; // packageimport -import dwtx.jface.text.IDocumentPartitionerExtension3; // packageimport -import dwtx.jface.text.IUndoManager; // packageimport -import dwtx.jface.text.ITextHoverExtension2; // packageimport -import dwtx.jface.text.IRepairableDocument; // packageimport -import dwtx.jface.text.IRewriteTarget; // packageimport -import dwtx.jface.text.DefaultPositionUpdater; // packageimport -import dwtx.jface.text.RewriteSessionEditProcessor; // packageimport -import dwtx.jface.text.TextViewerHoverManager; // packageimport -import dwtx.jface.text.DocumentRewriteSession; // packageimport -import dwtx.jface.text.TextViewer; // packageimport -import dwtx.jface.text.RegExMessages; // packageimport -import dwtx.jface.text.IDelayedInputChangeProvider; // packageimport -import dwtx.jface.text.ITextOperationTargetExtension; // packageimport -import dwtx.jface.text.IWidgetTokenOwner; // packageimport -import dwtx.jface.text.IViewportListener; // packageimport -import dwtx.jface.text.GapTextStore; // packageimport -import dwtx.jface.text.MarkSelection; // packageimport -import dwtx.jface.text.IDocumentPartitioningListenerExtension; // packageimport -import dwtx.jface.text.IDocumentAdapterExtension; // packageimport -import dwtx.jface.text.IInformationControlExtension; // packageimport -import dwtx.jface.text.IDocumentPartitioningListenerExtension2; // packageimport -import dwtx.jface.text.DefaultDocumentAdapter; // packageimport -import dwtx.jface.text.ITextViewerExtension3; // packageimport -import dwtx.jface.text.IInformationControlCreator; // packageimport -import dwtx.jface.text.TypedRegion; // packageimport -import dwtx.jface.text.ISynchronizable; // packageimport -import dwtx.jface.text.IMarkRegionTarget; // packageimport -import dwtx.jface.text.TextViewerUndoManager; // packageimport -import dwtx.jface.text.IRegion; // packageimport -import dwtx.jface.text.IInformationControlExtension2; // packageimport -import dwtx.jface.text.IDocumentExtension4; // packageimport -import dwtx.jface.text.IDocumentExtension2; // packageimport -import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport -import dwtx.jface.text.Assert; // packageimport -import dwtx.jface.text.DefaultInformationControl; // packageimport -import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport -import dwtx.jface.text.DocumentClone; // packageimport -import dwtx.jface.text.DefaultUndoManager; // packageimport -import dwtx.jface.text.IFindReplaceTarget; // packageimport -import dwtx.jface.text.IAutoEditStrategy; // packageimport -import dwtx.jface.text.ILineTrackerExtension; // packageimport -import dwtx.jface.text.IUndoManagerExtension; // packageimport -import dwtx.jface.text.TextSelection; // packageimport -import dwtx.jface.text.DefaultAutoIndentStrategy; // packageimport -import dwtx.jface.text.IAutoIndentStrategy; // packageimport -import dwtx.jface.text.IPainter; // packageimport -import dwtx.jface.text.IInformationControl; // packageimport -import dwtx.jface.text.IInformationControlExtension3; // packageimport -import dwtx.jface.text.ITextViewerExtension6; // packageimport -import dwtx.jface.text.IInformationControlExtension4; // packageimport -import dwtx.jface.text.DefaultLineTracker; // packageimport -import dwtx.jface.text.IDocumentInformationMappingExtension; // packageimport -import dwtx.jface.text.IRepairableDocumentExtension; // packageimport -import dwtx.jface.text.ITextHover; // packageimport -import dwtx.jface.text.FindReplaceDocumentAdapter; // packageimport -import dwtx.jface.text.ILineTracker; // packageimport -import dwtx.jface.text.Line; // packageimport -import dwtx.jface.text.ITextViewerExtension; // packageimport -import dwtx.jface.text.IDocumentAdapter; // packageimport -import dwtx.jface.text.TextEvent; // packageimport -import dwtx.jface.text.BadLocationException; // packageimport -import dwtx.jface.text.AbstractDocument; // packageimport -import dwtx.jface.text.AbstractLineTracker; // packageimport -import dwtx.jface.text.TreeLineTracker; // packageimport -import dwtx.jface.text.ITextPresentationListener; // packageimport -import dwtx.jface.text.Region; // packageimport -import dwtx.jface.text.ITextViewer; // packageimport -import dwtx.jface.text.IDocumentInformationMapping; // packageimport -import dwtx.jface.text.MarginPainter; // packageimport -import dwtx.jface.text.IPaintPositionManager; // packageimport -import dwtx.jface.text.TextPresentation; // packageimport -import dwtx.jface.text.IFindReplaceTargetExtension; // packageimport -import dwtx.jface.text.ISlaveDocumentManagerExtension; // packageimport -import dwtx.jface.text.ISelectionValidator; // packageimport -import dwtx.jface.text.IDocumentExtension; // packageimport -import dwtx.jface.text.PropagatingFontFieldEditor; // packageimport -import dwtx.jface.text.ConfigurableLineTracker; // packageimport -import dwtx.jface.text.SlaveDocumentEvent; // packageimport -import dwtx.jface.text.IDocumentListener; // packageimport -import dwtx.jface.text.PaintManager; // packageimport -import dwtx.jface.text.IFindReplaceTargetExtension3; // packageimport -import dwtx.jface.text.ITextDoubleClickStrategy; // packageimport -import dwtx.jface.text.IDocumentExtension3; // packageimport -import dwtx.jface.text.Position; // packageimport -import dwtx.jface.text.TextMessages; // packageimport -import dwtx.jface.text.CopyOnWriteTextStore; // packageimport -import dwtx.jface.text.WhitespaceCharacterPainter; // packageimport -import dwtx.jface.text.IPositionUpdater; // packageimport -import dwtx.jface.text.DefaultTextDoubleClickStrategy; // packageimport -import dwtx.jface.text.ListLineTracker; // packageimport -import dwtx.jface.text.ITextInputListener; // packageimport -import dwtx.jface.text.BadPositionCategoryException; // packageimport -import dwtx.jface.text.IWidgetTokenKeeperExtension; // packageimport -import dwtx.jface.text.IInputChangedListener; // packageimport -import dwtx.jface.text.ITextOperationTarget; // packageimport -import dwtx.jface.text.IDocumentInformationMappingExtension2; // packageimport -import dwtx.jface.text.ITextViewerExtension7; // packageimport -import dwtx.jface.text.IInformationControlExtension5; // packageimport -import dwtx.jface.text.IDocumentRewriteSessionListener; // packageimport -import dwtx.jface.text.JFaceTextUtil; // packageimport -import dwtx.jface.text.AbstractReusableInformationControlCreator; // packageimport -import dwtx.jface.text.TabsToSpacesConverter; // packageimport -import dwtx.jface.text.CursorLinePainter; // packageimport -import dwtx.jface.text.ITextHoverExtension; // packageimport -import dwtx.jface.text.IEventConsumer; // packageimport -import dwtx.jface.text.IDocument; // packageimport -import dwtx.jface.text.IWidgetTokenKeeper; // packageimport -import dwtx.jface.text.DocumentCommand; // packageimport -import dwtx.jface.text.TypedPosition; // packageimport -import dwtx.jface.text.IEditingSupportRegistry; // packageimport -import dwtx.jface.text.IDocumentPartitionerExtension; // packageimport -import dwtx.jface.text.AbstractHoverInformationControlManager; // packageimport -import dwtx.jface.text.IEditingSupport; // packageimport -import dwtx.jface.text.IMarkSelection; // packageimport -import dwtx.jface.text.ISlaveDocumentManager; // packageimport -import dwtx.jface.text.DocumentEvent; // packageimport -import dwtx.jface.text.DocumentPartitioningChangedEvent; // packageimport -import dwtx.jface.text.ITextStore; // packageimport -import dwtx.jface.text.JFaceTextMessages; // packageimport -import dwtx.jface.text.DocumentRewriteSessionEvent; // packageimport -import dwtx.jface.text.SequentialRewriteTextStore; // packageimport -import dwtx.jface.text.DocumentRewriteSessionType; // packageimport -import dwtx.jface.text.TextAttribute; // packageimport -import dwtx.jface.text.ITextViewerExtension4; // packageimport -import dwtx.jface.text.ITypedRegion; // packageimport - - import dwt.dwthelper.utils; import dwt.custom.StyledTextPrintOptions; @@ -162,14 +20,14 @@ /** * Extension interface for {@link dwtx.jface.text.ITextViewer}. Adds the * ability to print and set how hovers should be enriched when the mouse is moved into them. - * + * * @since 3.4 */ public interface ITextViewerExtension8 { - + /** * Print the text viewer contents using the given options. - * + * * @param options the print options */ void print(StyledTextPrintOptions options); @@ -184,12 +42,14 @@ * Note that a hover can only be enriched if its {@link IInformationControlExtension5#getInformationPresenterControlCreator()} * is not null. *

- * + * * @param mode the enrich mode, or null */ void setHoverEnrichMode(EnrichMode mode); - - + + + +} /** * Type-safe enum of the available enrich modes. */ @@ -198,26 +58,32 @@ /** * Enrich the hover shortly after the mouse has been moved into it and * stopped moving. - * + * * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode) */ - public static const EnrichMode AFTER_DELAY= new EnrichMode("after delay"); //$NON-NLS-1$ + public static const EnrichMode AFTER_DELAY; /** * Enrich the hover immediately when the mouse is moved into it. - * + * * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode) */ - public static const EnrichMode IMMEDIATELY= new EnrichMode("immediately"); //$NON-NLS-1$ + public static const EnrichMode IMMEDIATELY; /** * Enrich the hover on explicit mouse click. - * + * * @see ITextViewerExtension8#setHoverEnrichMode(dwtx.jface.text.ITextViewerExtension8.EnrichMode) */ - public static const EnrichMode ON_CLICK= new EnrichMode("on click"); //$NON-NLS-1$; + public static const EnrichMode ON_CLICK; + - + static this(){ + AFTER_DELAY= new EnrichMode("after delay"); //$NON-NLS-1$ + IMMEDIATELY= new EnrichMode("immediately"); //$NON-NLS-1$ + ON_CLICK= new EnrichMode("on click"); //$NON-NLS-1$; + } + private String fName; private this(String name) { @@ -231,5 +97,3 @@ return fName; } } - -} diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/JFaceTextUtil.d --- a/dwtx/jface/text/JFaceTextUtil.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/JFaceTextUtil.d Mon Aug 25 19:03:46 2008 +0200 @@ -171,19 +171,19 @@ *

* This class is neither intended to be instantiated nor subclassed. *

- * + * * @since 3.3 * @noinstantiate This class is not intended to be instantiated by clients. */ public final class JFaceTextUtil { - + private this() { // Do not instantiate } /** * Computes the line height for the given line range. - * + * * @param textWidget the StyledText widget * @param startLine the start line * @param endLine the end line (exclusive) @@ -193,7 +193,7 @@ public static int computeLineHeight(StyledText textWidget, int startLine, int endLine, int lineCount) { return getLinePixel(textWidget, endLine) - getLinePixel(textWidget, startLine); } - + /** * Returns the last fully visible line of the widget. The exact semantics of "last fully visible * line" are: @@ -201,39 +201,39 @@ *
  • the last line of which the last pixel is visible, if any *
  • otherwise, the only line that is partially visible * - * + * * @param widget the widget * @return the last fully visible line */ public static int getBottomIndex(StyledText widget) { int lastPixel= computeLastVisiblePixel(widget); - + // bottom is in [0 .. lineCount - 1] int bottom= widget.getLineIndex(lastPixel); // bottom is the first line - no more checking if (bottom is 0) return bottom; - + int pixel= widget.getLinePixel(bottom); // bottom starts on or before the client area start - bottom is the only visible line if (pixel <= 0) return bottom; - + int offset= widget.getOffsetAtLine(bottom); int height= widget.getLineHeight(offset); - + // bottom is not showing entirely - use the previous line if (pixel + height - 1 > lastPixel) return bottom - 1; - + // bottom is fully visible and its last line is exactly the last pixel return bottom; } /** * Returns the index of the first (possibly only partially) visible line of the widget - * + * * @param widget the widget * @return the index of the first line of which a pixel is visible */ @@ -241,7 +241,7 @@ // see StyledText#getPartialTopIndex() int top= widget.getTopIndex(); int pixels= widget.getLinePixel(top); - + // FIXME remove when https://bugs.eclipse.org/bugs/show_bug.cgi?id=123770 is fixed if (pixels is -widget.getLineHeight(widget.getOffsetAtLine(top))) { top++; @@ -250,13 +250,13 @@ if (pixels > 0) top--; - + return top; } /** * Returns the index of the last (possibly only partially) visible line of the widget - * + * * @param widget the text widget * @return the index of the last line of which a pixel is visible */ @@ -269,7 +269,7 @@ /** * Returns the last visible pixel in the widget's client area. - * + * * @param widget the widget * @return the last visible pixel in the widget's client area */ @@ -281,11 +281,11 @@ // lastPixel -= 4; return lastPixel; } - + /** * Returns the line index of the first visible model line in the viewer. The line may be only * partially visible. - * + * * @param viewer the text viewer * @return the first line of which a pixel is visible, or -1 for no line */ @@ -294,7 +294,7 @@ int widgetTop= getPartialTopIndex(widget); return widgetLine2ModelLine(viewer, widgetTop); } - + /** * Returns the last, possibly partially, visible line in the view port. * @@ -310,7 +310,7 @@ /** * Returns the range of lines that is visible in the viewer, including any partially visible * lines. - * + * * @param viewer the viewer * @return the range of lines that is visible in the viewer, null if no lines are * visible @@ -327,7 +327,7 @@ * Converts a widget line into a model (i.e. {@link IDocument}) line using the * {@link ITextViewerExtension5} if available, otherwise by adapting the widget line to the * viewer's {@link ITextViewer#getVisibleRegion() visible region}. - * + * * @param viewer the viewer * @param widgetLine the widget line to convert. * @return the model line corresponding to widgetLine or -1 to signal that there @@ -349,18 +349,18 @@ } return modelLine; } - + /** * Converts a model (i.e. {@link IDocument}) line into a widget line using the * {@link ITextViewerExtension5} if available, otherwise by adapting the model line to the * viewer's {@link ITextViewer#getVisibleRegion() visible region}. - * + * * @param viewer the viewer * @param modelLine the model line to convert. * @return the widget line corresponding to modelLine or -1 to signal that there * is no corresponding widget line */ - public static int modelLineToWidgetLine(ITextViewer viewer, final int modelLine) { + public static int modelLineToWidgetLine(ITextViewer viewer, int modelLine) { int widgetLine; if ( cast(ITextViewerExtension5)viewer ) { ITextViewerExtension5 extension= cast(ITextViewerExtension5) viewer; @@ -387,7 +387,7 @@ /** * Returns the number of hidden pixels of the first partially visible line. If there is no * partially visible line, zero is returned. - * + * * @param textWidget the widget * @return the number of hidden pixels of the first partial line, always >= 0 */ @@ -395,14 +395,14 @@ int top= getPartialTopIndex(textWidget); return -textWidget.getLinePixel(top); } - + /* * @see StyledText#getLinePixel(int) */ public static int getLinePixel(StyledText textWidget, int line) { return textWidget.getLinePixel(line); } - + /* * @see StyledText#getLineIndex(int) */ @@ -414,7 +414,7 @@ /** * Returns true if the widget displays the entire contents, i.e. it cannot * be vertically scrolled. - * + * * @param widget the widget * @return true if the widget displays the entire contents, i.e. it cannot * be vertically scrolled, false otherwise @@ -422,7 +422,7 @@ public static bool isShowingEntireContents(StyledText widget) { if (widget.getTopPixel() !is 0) // more efficient shortcut return false; - + int lastVisiblePixel= computeLastVisiblePixel(widget); int lastPossiblePixel= widget.getLinePixel(widget.getLineCount()); return lastPossiblePixel <= lastVisiblePixel; @@ -435,7 +435,7 @@ * @param region the region whose graphical extend must be computed * @param textViewer the text viewer containing the region * @return the graphical extend of the given region in the given viewer - * + * * @since 3.4 */ public static Rectangle computeArea(IRegion region, ITextViewer textViewer) { @@ -446,7 +446,7 @@ start= widgetRegion.getOffset(); end= start + widgetRegion.getLength(); } - + StyledText styledText= textViewer.getTextWidget(); Rectangle bounds; if (end > 0 && start < end) @@ -455,7 +455,7 @@ Point loc= styledText.getLocationAtOffset(start); bounds= new Rectangle(loc.x, loc.y, getAverageCharWidth(textViewer.getTextWidget()), styledText.getLineHeight(start)); } - + return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); } @@ -466,7 +466,7 @@ * @param region the document region * @param textViewer the viewer containing the region * @return the corresponding widget region - * + * * @since 3.4 */ private static IRegion modelRange2WidgetRange(IRegion region, ITextViewer textViewer) { @@ -474,22 +474,22 @@ ITextViewerExtension5 extension= cast(ITextViewerExtension5) textViewer; return extension.modelRange2WidgetRange(region); } - + IRegion visibleRegion= textViewer.getVisibleRegion(); int start= region.getOffset() - visibleRegion.getOffset(); int end= start + region.getLength(); if (end > visibleRegion.getLength()) end= visibleRegion.getLength(); - + return new Region(start, end - start); } /** * Returns the average character width of the given control's font. - * + * * @param control the control to calculate the average char width for * @return the average character width of the controls font - * + * * @since 3.4 */ public static int getAverageCharWidth(Control control) { diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/PropagatingFontFieldEditor.d --- a/dwtx/jface/text/PropagatingFontFieldEditor.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/PropagatingFontFieldEditor.d Mon Aug 25 19:03:46 2008 +0200 @@ -266,11 +266,21 @@ * @param target the target preference store * @param targetKey the key to be used in the target preference store */ - public static void startPropagate(final IPreferenceStore source, final String sourceKey, final IPreferenceStore target, final String targetKey) { - source.addPropertyChangeListener(new class() IPropertyChangeListener { + public static void startPropagate(IPreferenceStore source, String sourceKey, IPreferenceStore target, String targetKey) { + source.addPropertyChangeListener(new class(source,sourceKey,target,targetKey) IPropertyChangeListener { + IPreferenceStore source_; + String sourceKey_; + IPreferenceStore target_; + String targetKey_; + this(IPreferenceStore a, String b, IPreferenceStore c, String d){ + source_=a; + sourceKey_=b; + target_=c; + targetKey_=d; + } public void propertyChange(PropertyChangeEvent event) { - if (sourceKey.equals(event.getProperty())) - propagateFont(source, sourceKey, target, targetKey); + if (sourceKey_.equals(event.getProperty())) + propagateFont(source_, sourceKey_, target_, targetKey_); } }); diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/TextViewer.d --- a/dwtx/jface/text/TextViewer.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/TextViewer.d Mon Aug 25 19:03:46 2008 +0200 @@ -2629,7 +2629,7 @@ * @param fireEqualSelection true iff the event must be fired if the selection does not change * @since 3.0 */ - private void queuePostSelectionChanged(final bool fireEqualSelection) { + private void queuePostSelectionChanged(bool fireEqualSelection) { Display display= getDisplay(); if (display is null) return; @@ -4169,7 +4169,7 @@ // Perform the shift operation. Map map= (useDefaultPrefixes ? fDefaultPrefixChars : fIndentChars); for (int i= 0, j= 0; i < regions.length; i++, j += 2) { - String[] prefixes= (String[]) selectContentTypePlugin(regions[i].getType(), map); + String[] prefixes= stringArrayFromObject(selectContentTypePlugin(regions[i].getType(), map)); if (prefixes !is null && prefixes.length > 0 && lines[j] >= 0 && lines[j + 1] >= 0) { if (right) shiftRight(lines[j], lines[j + 1], prefixes[0]); @@ -4563,7 +4563,7 @@ } if (!ranges.isEmpty()) - fTextWidget.replaceStyleRanges(0, 0, (StyleRange[])ranges.toArray(new StyleRange[ranges.size()])); + fTextWidget.replaceStyleRanges(0, 0, arraycast!(StyleRange)(ranges.toArray())); } else { IRegion region= modelRange2WidgetRange(presentation.getCoverage()); @@ -5441,7 +5441,7 @@ * @since 3.1 */ public IEditingSupport[] getRegisteredSupports() { - return (IEditingSupport[]) fEditorHelpers.toArray(new IEditingSupport[fEditorHelpers.size()]); + return arraycast!(IEditingSupport)( fEditorHelpers.toArray()); } /* diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/TextViewerHoverManager.d --- a/dwtx/jface/text/TextViewerHoverManager.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/TextViewerHoverManager.d Mon Aug 25 19:03:46 2008 +0200 @@ -201,7 +201,7 @@ /** Internal monitor */ private Object fMutex= new Object(); /** The currently shown text hover. */ - private volatile ITextHover fTextHover; + private /+volatile+/ ITextHover fTextHover; /** * Tells whether the next mouse hover event * should be processed. diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/TextViewerUndoManager.d --- a/dwtx/jface/text/TextViewerUndoManager.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/TextViewerUndoManager.d Mon Aug 25 19:03:46 2008 +0200 @@ -190,20 +190,20 @@ *

    * This class is not intended to be subclassed. *

    - * + * * @see ITextViewer * @see ITextInputListener * @see IDocumentUndoManager * @see MouseListener * @see KeyListener * @see DocumentUndoManager - * + * * @since 3.2 * @noextend This class is not intended to be subclassed by clients. */ public class TextViewerUndoManager : IUndoManager, IUndoManagerExtension { - + /** * Internal listener to mouse and key events. */ @@ -287,7 +287,7 @@ */ public void documentUndoNotification(DocumentUndoEvent event ){ if (!isConnected()) return; - + int eventType= event.getEventType(); if (((eventType & DocumentUndoEvent.ABOUT_TO_UNDO) !is 0) || ((eventType & DocumentUndoEvent.ABOUT_TO_REDO) !is 0)) { if (event.isCompound()) { @@ -304,7 +304,7 @@ (cast(TextViewer)fTextViewer).ignoreAutoEditStrategies(true); } }); - + } else if (((eventType & DocumentUndoEvent.UNDONE) !is 0) || ((eventType & DocumentUndoEvent.REDONE) !is 0)) { fTextViewer.getTextWidget().getDisplay().syncExec(new class() Runnable { public void run() { @@ -320,7 +320,7 @@ if (extension !is null) extension.setRedraw(true); } - + // Reveal the change if this manager's viewer has the focus. if (fTextViewer !is null) { StyledText widget= fTextViewer.getTextWidget(); @@ -340,16 +340,16 @@ /** The text viewer the undo manager is connected to */ private ITextViewer fTextViewer; - + /** The undo level */ private int fUndoLevel; - + /** The document undo manager that is active. */ private IDocumentUndoManager fDocumentUndoManager; - + /** The document that is active. */ private IDocument fDocument; - + /** The document undo listener */ private IDocumentUndoListener fDocumentUndoListener; @@ -428,7 +428,7 @@ * @param title the dialog title * @param ex the exception */ - private void openErrorDialog(final String title, final Exception ex) { + private void openErrorDialog(String title, Exception ex) { Shell shell= null; if (isConnected()) { StyledText st= fTextViewer.getTextWidget(); @@ -439,16 +439,14 @@ MessageDialog.openError(shell, title, ex.getLocalizedMessage()); else { Display display; - final Shell finalShell= shell; + Shell finalShell= shell; if (finalShell !is null) display= finalShell.getDisplay(); else display= Display.getDefault(); - display.syncExec(new class() Runnable { - public void run() { - MessageDialog.openError(finalShell, title, ex.getLocalizedMessage()); - } - }); + display.syncExec(dgRunnable((Shell finalShell_, String title_, Exception ex_ ) { + MessageDialog.openError(finalShell_, title_, ex_.getLocalizedMessage()); + },finalShell, title, ex )); } } @@ -491,7 +489,7 @@ public void reset() { if (isConnected()) fDocumentUndoManager.reset(); - + } /* @@ -564,7 +562,7 @@ } return null; } - + private void connectDocumentUndoManager(IDocument document) { disconnectDocumentUndoManager(); if (document !is null) { diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/TreeLineTracker.d --- a/dwtx/jface/text/TreeLineTracker.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/TreeLineTracker.d Mon Aug 25 19:03:46 2008 +0200 @@ -365,7 +365,7 @@ * @return the line starting at or containing offset * @throws BadLocationException if the offset is invalid */ - private Node nodeByOffset(final int offset) { + private Node nodeByOffset(int offset) { /* * Works for any binary search tree. */ @@ -403,7 +403,7 @@ * @return the line number starting at or containing offset * @throws BadLocationException if the offset is invalid */ - private int lineByOffset(final int offset) { + private int lineByOffset(int offset) { /* * Works for any binary search tree. */ @@ -438,7 +438,7 @@ * @return the line with the given line number * @throws BadLocationException if the line is invalid */ - private Node nodeByLine(final int line) { + private Node nodeByLine(int line) { /* * Works for any binary search tree. */ @@ -472,7 +472,7 @@ * @return the line offset with the given line number * @throws BadLocationException if the line is invalid */ - private int offsetByLine(final int line) { + private int offsetByLine(int line) { /* * Works for any binary search tree. */ @@ -1167,7 +1167,7 @@ * @return the first node in node's parent chain that is reached from its left * subtree, null if there is none */ - private Node successorUp(final Node node) { + private Node successorUp(Node node) { Node child= node; Node parent= child.parent; while (parent !is null) { @@ -1292,7 +1292,7 @@ /* * @see dwtx.jface.text.ILineTracker#getLineInformationOfOffset(int) */ - public final IRegion getLineInformationOfOffset(final int offset) { + public final IRegion getLineInformationOfOffset(int offset) { // Inline nodeByOffset start as we need both node and offset int remaining= offset; Node node= fRoot; diff -r 8442b6b2da2d -r a9566845f1cb dwtx/jface/text/source/AnnotationBarHoverManager.d --- a/dwtx/jface/text/source/AnnotationBarHoverManager.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/source/AnnotationBarHoverManager.d Mon Aug 25 19:03:46 2008 +0200 @@ -113,7 +113,7 @@ import dwtx.jface.text.JFaceTextUtil; import dwtx.jface.text.Region; import dwtx.jface.text.TextUtilities; -import dwtx.jface.text.ITextViewerExtension8.EnrichMode; +import dwtx.jface.text.ITextViewerExtension8; /** diff -r 8442b6b2da2d -r a9566845f1cb dwtx/text/edits/TextEdit.d --- a/dwtx/text/edits/TextEdit.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/text/edits/TextEdit.d Mon Aug 25 19:03:46 2008 +0200 @@ -457,7 +457,7 @@ public final TextEdit[] getChildren() { if (fChildren is null) return EMPTY_ARRAY; - return (TextEdit[])fChildren.toArray(new TextEdit[fChildren.size()]); + return arraycast!(TextEdit)(fChildren.toArray()); } /** diff -r 8442b6b2da2d -r a9566845f1cb dwtx/text/edits/TextEditGroup.d --- a/dwtx/text/edits/TextEditGroup.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/text/edits/TextEditGroup.d Mon Aug 25 19:03:46 2008 +0200 @@ -166,7 +166,7 @@ * @return the managed text edits */ public TextEdit[] getTextEdits() { - return (TextEdit[]) fEdits.toArray(new TextEdit[fEdits.size()]); + return arraycast!(TextEdit)( fEdits.toArray()); } /** @@ -184,7 +184,7 @@ } else if (size is 1) { return (cast(TextEdit)fEdits.get(0)).getRegion(); } else { - return TextEdit.getCoverage((TextEdit[])fEdits.toArray(new TextEdit[fEdits.size()])); + return TextEdit.getCoverage(arraycast!(TextEdit)(fEdits.toArray())); } } }