diff dwtx/jface/text/TextViewer.d @ 159:7926b636c282

...
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 01:57:58 +0200
parents a9566845f1cb
children 3678e4f1a766
line wrap: on
line diff
--- a/dwtx/jface/text/TextViewer.d	Tue Aug 26 02:46:34 2008 +0200
+++ b/dwtx/jface/text/TextViewer.d	Wed Aug 27 01:57:58 2008 +0200
@@ -153,18 +153,10 @@
 import dwtx.jface.text.ITextViewerExtension4; // packageimport
 import dwtx.jface.text.ITypedRegion; // packageimport
 
-
 import dwt.dwthelper.utils;
-
 import dwtx.dwtxhelper.Collection;
-
-
-
-
-
-
-
-import java.util.regex.PatternSyntaxException;
+import dwtx.dwtxhelper.regex;
+import tango.text.convert.Format;
 
 import dwt.DWT;
 import dwt.custom.LineBackgroundEvent;
@@ -211,7 +203,7 @@
 import dwtx.jface.text.hyperlink.IHyperlinkDetector;
 import dwtx.jface.text.hyperlink.IHyperlinkDetectorExtension;
 import dwtx.jface.text.hyperlink.IHyperlinkPresenter;
-import dwtx.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY;
+import dwtx.jface.text.hyperlink.HyperlinkManager;
 import dwtx.jface.text.projection.ChildDocument;
 import dwtx.jface.text.projection.ChildDocumentManager;
 import dwtx.jface.viewers.IPostSelectionProvider;
@@ -1615,15 +1607,15 @@
     /** Caches the graphical coordinate of the first visible line */
     private int fTopInset= 0;
     /** The most recent document modification as widget command */
-    private WidgetCommand fWidgetCommand= new WidgetCommand();
+    private WidgetCommand fWidgetCommand;
     /** The DWT control's scrollbars */
     private ScrollBar fScroller;
     /** Listener on the visible document */
-    private VisibleDocumentListener fVisibleDocumentListener= new VisibleDocumentListener();
+    private VisibleDocumentListener fVisibleDocumentListener;
     /** Verify listener */
-    private TextVerifyListener fVerifyListener= new TextVerifyListener();
+    private TextVerifyListener fVerifyListener;
     /** The most recent widget modification as document command */
-    private DocumentCommand fDocumentCommand= new DocumentCommand();
+    private DocumentCommand fDocumentCommand;
     /** The viewer's find/replace target */
     private IFindReplaceTarget fFindReplaceTarget;
     /**
@@ -1640,7 +1632,7 @@
      * The viewer's manager of verify key listeners
      * @since 2.0
      */
-    private VerifyKeyListenersManager fVerifyKeyListenersManager= new VerifyKeyListenersManager();
+    private VerifyKeyListenersManager fVerifyKeyListenersManager;
     /**
      * The mark position.
      * @since 2.0
@@ -1650,12 +1642,12 @@
      * The mark position category.
      * @since 2.0
      */
-    private const String MARK_POSITION_CATEGORY="__mark_category_" + hashCode(); //$NON-NLS-1$
+    private const String MARK_POSITION_CATEGORY;
     /**
      * The mark position updater
      * @since 2.0
      */
-    private const IPositionUpdater fMarkPositionUpdater= new DefaultPositionUpdater(MARK_POSITION_CATEGORY);
+    private const IPositionUpdater fMarkPositionUpdater;
     /**
      * The flag indicating the redraw behavior
      * @since 2.0
@@ -1700,7 +1692,7 @@
      * The internal rewrite session listener.
      * @since 3.1
      */
-    private DocumentRewriteSessionListener fDocumentRewriteSessionListener= new DocumentRewriteSessionListener();
+    private DocumentRewriteSessionListener fDocumentRewriteSessionListener;
 
     /** Should the auto indent strategies ignore the next edit operation */
     protected bool  fIgnoreAutoIndent= false;
@@ -1794,11 +1786,21 @@
 
     //---- Construction and disposal ------------------
 
-
+    private void instanceInit(){
+        fWidgetCommand= new WidgetCommand();
+        fVisibleDocumentListener= new VisibleDocumentListener();
+        fVerifyListener= new TextVerifyListener();
+        fDocumentCommand= new DocumentCommand();
+        fVerifyKeyListenersManager= new VerifyKeyListenersManager();
+        MARK_POSITION_CATEGORY=Format("__mark_category_{}", hashCode()); //$NON-NLS-1$
+        fMarkPositionUpdater= new DefaultPositionUpdater(MARK_POSITION_CATEGORY);
+        fDocumentRewriteSessionListener= new DocumentRewriteSessionListener();
+    }
     /**
      * Internal use only
      */
     protected this() {
+        instanceInit();
     }
 
     /**
@@ -1810,6 +1812,7 @@
      *          <em>if <code>DWT.WRAP</code> is set then a custom document adapter needs to be provided, see {@link #createDocumentAdapter()}
      */
     public this(Composite parent, int styles) {
+        instanceInit();
         createControl(parent, styles);
     }
 
@@ -2350,7 +2353,7 @@
      *
      * @since 3.4
      */
-    public void setHoverEnrichMode(ITextViewerExtension8.EnrichMode mode) {
+    public void setHoverEnrichMode(ITextViewerExtension8_EnrichMode mode) {
         if (fTextHoverManager is null)
             return;
         fTextHoverManager.setHoverEnrichMode(mode);
@@ -5499,7 +5502,7 @@
      */
     private void ensureHyperlinkManagerInstalled() {
         if (fHyperlinkDetectors !is null && fHyperlinkDetectors.length > 0 && fHyperlinkPresenter !is null && fHyperlinkManager is null) {
-            DETECTION_STRATEGY strategy= fHyperlinkPresenter.canShowMultipleHyperlinks() ? HyperlinkManager.ALL : HyperlinkManager.FIRST;
+            HyperlinkManager.DETECTION_STRATEGY strategy= fHyperlinkPresenter.canShowMultipleHyperlinks() ? HyperlinkManager.ALL : HyperlinkManager.FIRST;
             fHyperlinkManager= new HyperlinkManager(strategy);
             fHyperlinkManager.install(this, fHyperlinkPresenter, fHyperlinkDetectors, fHyperlinkStateMask);
         }