Mercurial > projects > dwt-addons
diff dwtx/jface/text/TextViewer.d @ 140:26688fec6d23
Following dsss compile errors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 03:23:46 +0200 |
parents | b6bad70d540a |
children | 75302ef3f92f |
line wrap: on
line diff
--- a/dwtx/jface/text/TextViewer.d Sun Aug 24 02:31:41 2008 +0200 +++ b/dwtx/jface/text/TextViewer.d Sun Aug 24 03:23:46 2008 +0200 @@ -263,7 +263,7 @@ * @since 3.4 */ private static final int TEXT_HOVER_HEIGHT_CHARS= 12; //used to be 10 (text font) - + /** * Represents a replace command that brings the text viewer's text widget * back in synchronization with text viewer's document after the document @@ -309,8 +309,8 @@ } catch (BadLocationException x) { preservedText= null; - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.WidgetCommand.setEvent")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.WidgetCommand.setEvent")); //$NON-NLS-1$ } } else preservedText= null; @@ -343,12 +343,12 @@ public void getNextOffset(MovementEvent event) { if (event.movement !is DWT.MOVEMENT_WORD_END) return; - - if cast(TRACE_DOUBLE_CLICK) { - System.out.println("\n+++"); //$NON-NLS-1$ + + if (TRACE_DOUBLE_CLICK) { + System.out_.println("\n+++"); //$NON-NLS-1$ print(event); } - + if (fDoubleClickSelection !is null) { if (fDoubleClickSelection.x <= event.offset && event.offset <= fDoubleClickSelection.y) event.newOffset= fDoubleClickSelection.y; @@ -362,20 +362,20 @@ public void getPreviousOffset(MovementEvent event) { if (event.movement !is DWT.MOVEMENT_WORD_START) return; - - if cast(TRACE_DOUBLE_CLICK) { - System.out.println("\n---"); //$NON-NLS-1$ + + if (TRACE_DOUBLE_CLICK) { + System.out_.println("\n---"); //$NON-NLS-1$ print(event); } if (fDoubleClickSelection is null) { ITextDoubleClickStrategy s= cast(ITextDoubleClickStrategy) selectContentTypePlugin(getSelectedRange().x, fDoubleClickStrategies); if (s !is null) { StyledText textWidget= getTextWidget(); - s.doubleClicked(TextViewer.this); + s.doubleClicked(this.outer); fDoubleClickSelection= textWidget.getSelection(); event.newOffset= fDoubleClickSelection.x; - if cast(TRACE_DOUBLE_CLICK) - System.out.println("- setting selection: x= " + fDoubleClickSelection.x + ", y= " + fDoubleClickSelection.y); //$NON-NLS-1$ //$NON-NLS-2$ + if (TRACE_DOUBLE_CLICK) + System.out_.println("- setting selection: x= " + fDoubleClickSelection.x + ", y= " + fDoubleClickSelection.y); //$NON-NLS-1$ //$NON-NLS-2$ } } else { if (fDoubleClickSelection.x <= event.offset && event.offset <= fDoubleClickSelection.y) @@ -386,16 +386,16 @@ /** * Print trace info about <code>MovementEvent</code>. - * + * * @param e the event to print * @since 3.3 */ private void print(MovementEvent e) { - System.out.println("line offset: " + e.lineOffset); //$NON-NLS-1$ - System.out.println("line: " + e.lineText); //$NON-NLS-1$ - System.out.println("type: " + e.movement); //$NON-NLS-1$ - System.out.println("offset: " + e.offset); //$NON-NLS-1$ - System.out.println("newOffset: " + e.newOffset); //$NON-NLS-1$ + System.out_.println("line offset: " + e.lineOffset); //$NON-NLS-1$ + System.out_.println("line: " + e.lineText); //$NON-NLS-1$ + System.out_.println("type: " + e.movement); //$NON-NLS-1$ + System.out_.println("offset: " + e.offset); //$NON-NLS-1$ + System.out_.println("newOffset: " + e.newOffset); //$NON-NLS-1$ } /** @@ -1089,16 +1089,16 @@ * @see IFindReplaceTargetExtension#setScope(IRegion) * @since 2.0 */ - public void setScope(IRegion scope) { + public void setScope(IRegion scope_) { if (fRange !is null) fRange.uninstall(); - if (scope is null) { + if (scope_ is null) { fRange= null; return; } - fRange= new FindReplaceRange(scope); + fRange= new FindReplaceRange(scope_); fRange.setHighlightColor(fScopeHighlightColor); fRange.install(); } @@ -1247,7 +1247,7 @@ fStateMask= stateMask; } } - + /** * Captures and remembers the viewer state (selection and visual position). {@link TextViewer.ViewerState} * instances are normally used once and then discarded, similar to the following snippet: @@ -1256,7 +1256,7 @@ * doStuff(); // operation that may call setRedraw() and perform complex document modifications * state.restore(true); // restore the remembered state * </pre> - * + * * @since 3.3 */ private final class ViewerState { @@ -1289,7 +1289,7 @@ /** * Returns the normalized selection, i.e. the the selection length is always non-negative. - * + * * @return the normalized selection */ public Point getSelection() { @@ -1300,7 +1300,7 @@ /** * Updates the selection. - * + * * @param offset the new selection offset * @param length the new selection length */ @@ -1315,7 +1315,7 @@ /** * Restores the state and disconnects it from the document. The selection is no longer * tracked after this call. - * + * * @param restoreViewport <code>true</code> to restore both selection and viewport, * <code>false</code> to only restore the selection */ @@ -1363,7 +1363,7 @@ /** * Remembers the viewer state. - * + * * @param document the document to remember the state of */ private void connect(IDocument document) { @@ -1409,7 +1409,7 @@ /** * Updates a position with the given information and clears its deletion state. - * + * * @param position the position to update * @param offset the new selection offset * @param length the new selection length @@ -1424,14 +1424,14 @@ /** * Returns the document line to keep visually stable. If the caret line is (partially) * visible, it is returned, otherwise the topmost (partially) visible line is returned. - * + * * @return the visually stable line of this viewer state */ private int getStableLine() { int stableLine; // the model line that we try to keep stable int caretLine= getTextWidget().getLineAtOffset(getTextWidget().getCaretOffset()); if (caretLine < JFaceTextUtil.getPartialTopIndex(getTextWidget()) || caretLine > JFaceTextUtil.getPartialBottomIndex(getTextWidget())) { - stableLine= JFaceTextUtil.getPartialTopIndex(TextViewer.this); + stableLine= JFaceTextUtil.getPartialTopIndex(this.outer); } else { stableLine= widgetLine2ModelLine(caretLine); } @@ -1441,7 +1441,7 @@ /** * Returns <code>true</code> if the viewer state is being tracked, <code>false</code> * otherwise. - * + * * @return the tracking state */ private bool isConnected() { @@ -1469,7 +1469,7 @@ /** * Internal cursor listener i.e. aggregation of mouse and key listener. - * + * * @since 3.0 */ private class CursorListener : KeyListener, MouseListener { @@ -1563,8 +1563,8 @@ } } } - - + + /** * Identifies the scrollbars as originators of a view port change. */ @@ -1843,7 +1843,7 @@ protected void createControl(Composite parent, int styles) { fTextWidget= createTextWidget(parent, styles); - + // Support scroll page upon MOD1+MouseWheel fTextWidget.addListener(DWT.MouseWheel, new class() Listener { @@ -1862,7 +1862,7 @@ updateViewportListeners(INTERNAL); } }); - + fTextWidget.addDisposeListener( new class() DisposeListener { public void widgetDisposed(DisposeEvent e) { @@ -1958,7 +1958,7 @@ * control has been disposed. */ protected void handleDispose() { - + setDocument(null); if (fPaintManager !is null) { @@ -2047,7 +2047,7 @@ fVisibleDocument= null; fDocument= null; fScroller= null; - + fTextWidget= null; } @@ -2085,7 +2085,7 @@ * {@link ITextViewerExtension2#removeAutoEditStrategy(IAutoEditStrategy, String)} instead */ public void setAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType) { - setAutoEditStrategies(new IAutoEditStrategy[] { strategy }, contentType); + setAutoEditStrategies([ strategy ], contentType); } /** @@ -2275,7 +2275,7 @@ if (fTextHovers is null) return; - Iterator iter= new HashSet(fTextHovers.keySet()).iterator(); + Iterator iter= (new HashSet(fTextHovers.keySet())).iterator(); while (iter.hasNext()) { TextHoverKey key= cast(TextHoverKey)iter.next(); if (key.fContentType.equals(contentType)) @@ -2319,8 +2319,8 @@ } return cast(ITextHover) textHover; } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ } return null; } @@ -2347,7 +2347,7 @@ /** * {@inheritDoc} - * + * * @since 3.4 */ public void setHoverEnrichMode(ITextViewerExtension8.EnrichMode mode) { @@ -2456,7 +2456,7 @@ IRegion widgetSelection= modelRange2ClosestWidgetRange(new Region(selectionOffset, selectionLength)); if (widgetSelection !is null) { - int[] selectionRange= new int[] { widgetSelection.getOffset(), widgetSelection.getLength() }; + int[] selectionRange= [ widgetSelection.getOffset(), widgetSelection.getLength() ]; validateSelectionRange(selectionRange); if (selectionRange[0] >= 0) { fTextWidget.setSelectionRange(selectionRange[0], selectionRange[1]); @@ -3128,7 +3128,7 @@ * accurate if the widget does not use variable line heights - for that reason, clients should * not use this method any longer and use the client area height of the text widget to find out * how much content fits into it. - * + * * @return the view port height in lines * @deprecated as of 3.2 */ @@ -3148,7 +3148,7 @@ if (fTextWidget is null) return -1; - + int widgetBottom= JFaceTextUtil.getBottomIndex(fTextWidget); return widgetLine2ModelLine(widgetBottom); } @@ -3164,8 +3164,8 @@ top= getVisibleDocument().getLineOffset(top); return widgetOffset2ModelOffset(top); } catch (BadLocationException ex) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getTopIndexStartOffset")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getTopIndexStartOffset")); //$NON-NLS-1$ } } @@ -3189,8 +3189,8 @@ return Math.min(coverageEndOffset, bottomEndOffset); } catch (BadLocationException ex) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getBottomIndexEndOffset")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getBottomIndexEndOffset")); //$NON-NLS-1$ return getDocument().getLength() - 1; } } @@ -3207,7 +3207,7 @@ IRegion widgetRange= modelRange2ClosestWidgetRange(modelRange); if (widgetRange !is null) { - int[] range= new int[] { widgetRange.getOffset(), widgetRange.getLength() }; + int[] range= [ widgetRange.getOffset(), widgetRange.getLength() ]; validateSelectionRange(range); if (range[0] >= 0) internalRevealRange(range[0], range[0] + range[1]); @@ -3241,7 +3241,7 @@ // scroll vertically int bottom= JFaceTextUtil.getBottomIndex(fTextWidget); int lines= bottom - top; - + // if the widget is not scrollable as it is displaying the entire content // setTopIndex won't have any effect. @@ -3342,7 +3342,7 @@ Rectangle bounds= fTextWidget.getTextBounds(start, end - 1); return new Region(bounds.x, bounds.width); } - + return new Region(fTextWidget.getLocationAtOffset(start).x, 0); } @@ -3481,7 +3481,7 @@ */ protected void setVisibleDocument(IDocument document) { - if (fVisibleDocument is document && fVisibleDocument instanceof ChildDocument) { + if (fVisibleDocument is document && cast(ChildDocument)fVisibleDocument ) { // optimization for new child documents return; } @@ -3659,8 +3659,8 @@ try { return selectContentTypePlugin(TextUtilities.getContentType(getDocument(), getDocumentPartitioning(), offset, true), plugins); } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ } return null; } @@ -3692,9 +3692,9 @@ protected void customizeDocumentCommand(DocumentCommand command) { if (isIgnoringAutoEditStrategies()) return; - + IDocument document= getDocument(); - + if (fTabsToSpacesConverter !is null) fTabsToSpacesConverter.customizeDocumentCommand(document, command); @@ -3778,8 +3778,8 @@ } } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.verifyText")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.verifyText")); //$NON-NLS-1$ } finally { @@ -3969,7 +3969,7 @@ * @param delete <code>true</code> if the region should be deleted rather than copied. * @since 2.0 */ - protected void copyMarkedRegion(bool delete) { + protected void copyMarkedRegion(bool delete_) { if (fTextWidget is null) return; @@ -3984,7 +3984,7 @@ else fTextWidget.setSelection(widgetMarkOffset, selection.x); - if (delete) { + if (delete_) { fTextWidget.cut(); } else { fTextWidget.copy(); @@ -4077,8 +4077,8 @@ return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1); } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getFirstCompleteLineOfRegion")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getFirstCompleteLineOfRegion")); //$NON-NLS-1$ } return -1; @@ -4133,7 +4133,7 @@ protected void shift(bool useDefaultPrefixes, bool right, bool ignoreWhitespace) { if (fUndoManager !is null) fUndoManager.beginCompoundChange(); - + IDocument d= getDocument(); Map partitioners= null; DocumentRewriteSession rewriteSession= null; @@ -4179,14 +4179,14 @@ } } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.shift_1")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.shift_1")); //$NON-NLS-1$ } finally { if (partitioners !is null) TextUtilities.addDocumentPartitioners(d, partitioners); - + if ( cast(IDocumentExtension4)d ) { IDocumentExtension4 extension= cast(IDocumentExtension4) d; extension.stopRewriteSession(rewriteSession); @@ -4219,8 +4219,8 @@ } } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println("TextViewer.shiftRight: BadLocationException"); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println("TextViewer.shiftRight: BadLocationException"); //$NON-NLS-1$ } } @@ -4285,8 +4285,8 @@ } } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println("TextViewer.shiftLeft: BadLocationException"); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println("TextViewer.shiftLeft: BadLocationException"); //$NON-NLS-1$ } } @@ -4306,7 +4306,7 @@ /** * {@inheritDoc} - * + * * @since 3.4 */ public void print(StyledTextPrintOptions options) { @@ -4317,12 +4317,12 @@ final Printer printer= new Printer(data); final Runnable styledTextPrinter= fTextWidget.print(printer, options); - Thread printingThread= new Thread("Printing") { //$NON-NLS-1$ - public void run() { - styledTextPrinter.run(); - printer.dispose(); - } - }; + void threadrun() { + styledTextPrinter.run(); + printer.dispose(); + } + Thread printingThread= new Thread( &threadrun ); + printingThread.name = "Printing"; //$NON-NLS-1$ printingThread.start(); } } @@ -4419,8 +4419,8 @@ } } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.findAndSelect")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.findAndSelect")); //$NON-NLS-1$ } return -1; @@ -4497,8 +4497,8 @@ } catch (BadLocationException x) { - if cast(TRACE_ERRORS) - System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.findAndSelect")); //$NON-NLS-1$ + if (TRACE_ERRORS) + System.out_.println(JFaceTextMessages.getString("TextViewer.error.bad_location.findAndSelect")); //$NON-NLS-1$ } return -1; @@ -4552,7 +4552,7 @@ range= modelStyleRange2WidgetStyleRange(range); if (range !is null) fTextWidget.setStyleRange(range); - + ArrayList ranges= new ArrayList(presentation.getDenumerableRanges()); Iterator e= presentation.getNonDefaultStyleRangeIterator(); while (e.hasNext()) { @@ -4561,10 +4561,10 @@ if (range !is null) ranges.add(range); } - + if (!ranges.isEmpty()) fTextWidget.replaceStyleRanges(0, 0, (StyleRange[])ranges.toArray(new StyleRange[ranges.size()])); - + } else { IRegion region= modelRange2WidgetRange(presentation.getCoverage()); if (region is null) @@ -5451,11 +5451,11 @@ public void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors, int eventStateMask) { if (fHyperlinkDetectors !is null) { for (int i= 0; i < fHyperlinkDetectors.length; i++) { - if (fHyperlinkDetectors[i] instanceof IHyperlinkDetectorExtension) + if (cast(IHyperlinkDetectorExtension)fHyperlinkDetectors[i] ) (cast(IHyperlinkDetectorExtension)fHyperlinkDetectors[i]).dispose(); } } - + bool enable= hyperlinkDetectors !is null && hyperlinkDetectors.length > 0; fHyperlinkStateMask= eventStateMask; fHyperlinkDetectors= hyperlinkDetectors;