diff dwtx/jface/internal/text/link/contentassist/CompletionProposalPopup2.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents 7926b636c282
children
line wrap: on
line diff
--- a/dwtx/jface/internal/text/link/contentassist/CompletionProposalPopup2.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/internal/text/link/contentassist/CompletionProposalPopup2.d	Mon Sep 08 00:51:37 2008 +0200
@@ -90,7 +90,7 @@
     /** The used additional info controller */
     private AdditionalInfoController2 fAdditionalInfoController;
     /** The closing strategy for this completion proposal popup */
-    private PopupCloser2 fPopupCloser= new PopupCloser2();
+    private PopupCloser2 fPopupCloser;
     /** The popup shell */
     private Shell fProposalShell;
     /** The proposal table */
@@ -100,7 +100,7 @@
     /** The key listener to control navigation */
     private KeyListener fKeyListener;
     /** List of document events used for filtering proposals */
-    private List fDocumentEvents= new ArrayList();
+    private List fDocumentEvents;
     /** Listener filling the document event queue */
     private IDocumentListener fDocumentListener;
     /** Reentrance count for <code>filterProposals</code> */
@@ -168,6 +168,8 @@
      * @since 2.0
      */
     public this(ContentAssistant2 contentAssistant, ITextViewer viewer, AdditionalInfoController2 infoController) {
+        fPopupCloser= new PopupCloser2();
+        fDocumentEvents= new ArrayList();
 
         fModificationEditingSupport_init();
         fFocusEditingSupport_init();
@@ -521,7 +523,7 @@
 
         fFilteredProposals= null;
 
-        fContentAssistant.possibleCompletionsClosed();
+        fContentAssistant.possibleCompletionsClosed_package();
     }
 
     /**
@@ -579,7 +581,7 @@
                 if (fIsColoredLabelsSupportEnabled)
                     TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges);
 
-                item.setData(p);
+                item.setData(cast(Object)p);
 
                 if (validate && validateProposal(document, p, endOffset, null)) {
                     selectionIndex= i;
@@ -623,7 +625,7 @@
      * @return the height hint for <code>table</code>
      */
     private int getTableHeightHint(Table table, int rows) {
-        if (table.getFont().equals(JFaceResources.getDefaultFont()))
+        if (table.getFont().opEquals(JFaceResources.getDefaultFont()))
             table.setFont(JFaceResources.getDialogFont());
         int result= table.getItemHeight() * rows;
         if (table.getLinesVisible())
@@ -876,31 +878,29 @@
     private void filterProposals() {
         ++ fInvocationCounter;
         Control control= fViewer.getTextWidget();
-        control.getDisplay().asyncExec(new class()  Runnable {
-            long fCounter= fInvocationCounter;
-            public void run() {
+        control.getDisplay().asyncExec(dgRunnable( (long fInvocationCounter_) {
+            long fCounter= fInvocationCounter_;
 
-                if (fCounter !is fInvocationCounter) return;
+            if (fCounter !is fInvocationCounter) return;
 
-                int offset= fViewer.getSelectedRange().x;
-                ICompletionProposal[] proposals= null;
-                try  {
-                    if (offset > -1) {
-                        DocumentEvent event= TextUtilities.mergeProcessedDocumentEvents(fDocumentEvents);
-                        proposals= computeFilteredProposals(offset, event);
-                    }
-                } catch (BadLocationException x)  {
-                } finally  {
-                    fDocumentEvents.clear();
+            int offset= fViewer.getSelectedRange().x;
+            ICompletionProposal[] proposals= null;
+            try  {
+                if (offset > -1) {
+                    DocumentEvent event= TextUtilities.mergeProcessedDocumentEvents(fDocumentEvents);
+                    proposals= computeFilteredProposals(offset, event);
                 }
-                fFilterOffset= offset;
+            } catch (BadLocationException x)  {
+            } finally  {
+                fDocumentEvents.clear();
+            }
+            fFilterOffset= offset;
 
-                if (proposals !is null && proposals.length > 0)
-                    setProposals(proposals);
-                else
-                    hide();
-            }
-        });
+            if (proposals !is null && proposals.length > 0)
+                setProposals(proposals);
+            else
+                hide();
+        }, fInvocationCounter));
     }
 
     /**
@@ -937,13 +937,13 @@
 
                 ICompletionProposalExtension2 p= cast(ICompletionProposalExtension2) proposals[i];
                 if (p.validate(document, offset, event))
-                    filtered.add(p);
+                    filtered.add(cast(Object)p);
 
             } else if (cast(ICompletionProposalExtension)proposals[i] ) {
 
                 ICompletionProposalExtension p= cast(ICompletionProposalExtension) proposals[i];
                 if (p.isValidFor(document, offset))
-                    filtered.add(p);
+                    filtered.add(cast(Object)p);
 
             } else {
                 // restore original behavior
@@ -953,9 +953,7 @@
             }
         }
 
-        ICompletionProposal[] p= new ICompletionProposal[filtered.size()];
-        filtered.toArray(p);
-        return p;
+        return arraycast!(ICompletionProposal)(filtered.toArray());
     }
 
     /**