diff dwtx/jface/text/contentassist/CompletionProposalPopup.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/contentassist/CompletionProposalPopup.d	Sun Aug 24 02:31:41 2008 +0200
+++ b/dwtx/jface/text/contentassist/CompletionProposalPopup.d	Sun Aug 24 03:23:46 2008 +0200
@@ -137,23 +137,23 @@
 
     /**
      * Completion proposal selection handler.
-     * 
+     *
      * @since 3.4
      */
     final class ProposalSelectionHandler : AbstractHandler {
-        
+
         /**
          * Selection operation codes.
          */
         static final int SELECT_NEXT= 1;
         static final int SELECT_PREVIOUS= 2;
 
-        
+
         private int fOperationCode;
 
         /**
          * Creates a new selection handler.
-         * 
+         *
          * @param operationCode the operation code
          * @since 3.4
          */
@@ -186,11 +186,11 @@
         }
 
     }
-    
+
 
     /**
      * The empty proposal displayed if there is nothing else to show.
-     * 
+     *
      * @since 3.2
      */
     private static final class EmptyProposal : ICompletionProposal, ICompletionProposalExtension {
@@ -294,15 +294,15 @@
 
     private final class CommandKeyListener : KeyAdapter {
         private KeySequence fCommandSequence;
-        
+
         private this(KeySequence keySequence) {
             fCommandSequence= keySequence;
         }
-        
+
         public void keyPressed(KeyEvent e) {
             if (!Helper.okToUse(fProposalShell))
                 return;
-            
+
             int accelerator= SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
             KeySequence sequence= KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator));
             if (sequence.equals(fCommandSequence))
@@ -310,11 +310,11 @@
                     incrementalComplete();
                 else
                     showProposals(false);
-            
+
         }
     }
-    
-    
+
+
     /** The associated text viewer. */
     private ITextViewer fViewer;
     /** The associated content assistant. */
@@ -382,14 +382,14 @@
     private bool fIsFilteredSubset;
     /**
      * The filter runnable.
-     * 
+     *
      * @since 3.1.1
      */
     private final Runnable fFilterRunnable= new class()  Runnable {
         public void run() {
             if (!fIsFilterPending)
                 return;
-            
+
             fIsFilterPending= false;
 
             if (!Helper.okToUse(fContentAssistSubjectControlAdapter.getControl()))
@@ -417,50 +417,50 @@
     /**
      * <code>true</code> if <code>fFilterRunnable</code> has been
      * posted, <code>false</code> if not.
-     * 
+     *
      * @since 3.1.1
      */
     private bool fIsFilterPending= false;
     /**
      * The info message at the bottom of the popup, or <code>null</code> for no popup (if
      * ContentAssistant does not provide one).
-     * 
+     *
      * @since 3.2
      */
     private Label fMessageText;
     /**
      * The font used for <code>fMessageText</code> or null; dispose when done.
-     * 
+     *
      * @since 3.2
      */
     private Font fMessageTextFont;
     /**
      * The most recent completion offset (used to determine repeated invocation)
-     * 
+     *
      * @since 3.2
      */
     private int fLastCompletionOffset;
     /**
      * The (reusable) empty proposal.
-     * 
+     *
      * @since 3.2
      */
     private final EmptyProposal fEmptyProposal= new EmptyProposal();
     /**
      * The text for the empty proposal, or <code>null</code> to use the default text.
-     * 
+     *
      * @since 3.2
      */
     private String fEmptyMessage= null;
     /**
      * Tells whether colored labels support is enabled.
      * Only valid while the popup is active.
-     * 
+     *
      * @since 3.4
      */
     private bool fIsColoredLabelsSupportEnabled= false;
 
-    
+
     /**
      * Creates a new completion proposal popup for the given elements.
      *
@@ -521,7 +521,7 @@
                     int count= (fComputedProposals is null ? 0 : fComputedProposals.length);
                     if (count is 0 && hideWhenNoProposals(autoActivated))
                         return;
-                    
+
                     if (count is 1 && !autoActivated && canAutoInsert(fComputedProposals[0])) {
                         insertProposal(fComputedProposals[0], cast(wchar) 0, 0, fInvocationOffset);
                         hide();
@@ -539,11 +539,11 @@
 
         return getErrorMessage();
     }
-    
+
     /**
      * Hides the popup and returns <code>true</code> if the popup is configured
      * to never display an empty list. Returns <code>false</code> otherwise.
-     * 
+     *
      * @param autoActivated whether the invocation was auto-activated
      * @return <code>false</code> if an empty list should be displayed, <code>true</code> otherwise
      * @since 3.2
@@ -564,7 +564,7 @@
     /**
      * If content assist is set up to handle cycling, then the proposals are recomputed. Otherwise,
      * nothing happens.
-     * 
+     *
      * @since 3.2
      */
     private void handleRepeatedInvocation() {
@@ -606,7 +606,7 @@
         Control control= fContentAssistSubjectControlAdapter.getControl();
         fProposalShell= new Shell(control.getShell(), DWT.ON_TOP | DWT.RESIZE );
         fProposalShell.setFont(JFaceResources.getDefaultFont());
-        if cast(USE_VIRTUAL) {
+        if (USE_VIRTUAL) {
             fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL | DWT.VIRTUAL);
 
             Listener listener= new class()  Listener {
@@ -618,7 +618,7 @@
         } else {
             fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL);
         }
-        
+
         fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled();
         if (fIsColoredLabelsSupportEnabled)
             TableOwnerDrawSupport.install(fProposalTable);
@@ -632,7 +632,7 @@
         layout.marginHeight= 0;
         layout.verticalSpacing= 1;
         fProposalShell.setLayout(layout);
-        
+
         if (fContentAssistant.isStatusLineVisible()) {
             createMessageText();
         }
@@ -669,7 +669,7 @@
                 fSize= fProposalShell.getSize();
             }
         });
-        
+
         fProposalShell.setBackground(control.getDisplay().getSystemColor(DWT.COLOR_GRAY));
 
         Color c= getBackgroundColor(control);
@@ -696,14 +696,14 @@
         });
 
         fProposalTable.setHeaderVisible(false);
-        
+
         addCommandSupport(fProposalTable);
     }
 
     /**
      * Returns the minimal required height for the proposal, may return 0 if the popup has not been
      * created yet.
-     * 
+     *
      * @return the minimal height
      * @since 3.3
      */
@@ -721,7 +721,7 @@
 
     /**
      * Adds command support to the given control.
-     * 
+     *
      * @param control the control to watch for focus
      * @since 3.2
      */
@@ -777,7 +777,7 @@
 
     /**
      * Returns the background color to use.
-     * 
+     *
      * @param control the control to get the display from
      * @return the background color
      * @since 3.2
@@ -791,7 +791,7 @@
 
     /**
      * Returns the foreground color to use.
-     * 
+     *
      * @param control the control to get the display from
      * @return the foreground color
      * @since 3.2
@@ -802,10 +802,10 @@
             c= JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
         return c;
     }
-    
+
     /**
      * Creates the caption line under the proposal table.
-     * 
+     *
      * @since 3.2
      */
     private void createMessageText() {
@@ -854,7 +854,7 @@
 
             String displayString;
             StyleRange[] styleRanges= null;
-            if (fIsColoredLabelsSupportEnabled && current instanceof ICompletionProposalExtension6) {
+            if (fIsColoredLabelsSupportEnabled && cast(ICompletionProposalExtension6)current ) {
                 StyledString styledString= (cast(ICompletionProposalExtension6)current).getStyledDisplayString();
                 displayString= styledString.getString();
                 styleRanges= styledString.getStyleRanges();
@@ -864,7 +864,7 @@
             item.setText(displayString);
             if (fIsColoredLabelsSupportEnabled)
                 TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges);
-            
+
             item.setImage(current.getImage());
             item.setData(current);
         } else {
@@ -884,11 +884,11 @@
          */
         if (fIsFilterPending)
             fFilterRunnable.run();
-        
+
         // filter runnable may have hidden the proposals
         if (!Helper.okToUse(fProposalTable))
             return null;
-        
+
         int i= fProposalTable.getSelectionIndex();
         if (fFilteredProposals is null || i < 0 || i >= fFilteredProposals.length)
             return null;
@@ -952,7 +952,7 @@
             }
 
 
-            if (p instanceof ICompletionProposalExtension2 && fViewer !is null) {
+            if (cast(ICompletionProposalExtension2)p && fViewer !is null) {
                 ICompletionProposalExtension2 e= cast(ICompletionProposalExtension2) p;
                 e.apply(fViewer, trigger, stateMask, offset);
             } else if ( cast(ICompletionProposalExtension)p ) {
@@ -1050,20 +1050,20 @@
             fProposalShell.dispose();
             fProposalShell= null;
         }
-        
+
         if (fMessageTextFont !is null) {
             fMessageTextFont.dispose();
             fMessageTextFont= null;
         }
-        
+
         if (fMessageText !is null) {
             fMessageText= null;
         }
-        
+
         fEmptyMessage= null;
-        
+
         fLastCompletionOffset= -1;
-        
+
         fContentAssistant.fireSessionEndEvent();
     }
 
@@ -1087,7 +1087,7 @@
         }
 
         if (fLastProposal !is null) {
-            if (fLastProposal instanceof ICompletionProposalExtension2 && fViewer !is null) {
+            if (cast(ICompletionProposalExtension2)fLastProposal  && fViewer !is null) {
                 ICompletionProposalExtension2 extension= cast(ICompletionProposalExtension2) fLastProposal;
                 extension.unselected(fViewer);
             }
@@ -1123,18 +1123,18 @@
             return;
 
         if (Helper.okToUse(fProposalTable)) {
-            if (oldProposal instanceof ICompletionProposalExtension2 && fViewer !is null)
+            if (cast(ICompletionProposalExtension2)oldProposal  && fViewer !is null)
                 (cast(ICompletionProposalExtension2) oldProposal).unselected(fViewer);
-            
+
             if (proposals is null || proposals.length is 0) {
                 fEmptyProposal.fOffset= fFilterOffset;
                 fEmptyProposal.fDisplayString= fEmptyMessage !is null ? fEmptyMessage : JFaceTextMessages.getString("CompletionProposalPopup.no_proposals"); //$NON-NLS-1$
-                proposals= new ICompletionProposal[] { fEmptyProposal };
+                proposals= [ fEmptyProposal ];
             }
 
             fFilteredProposals= proposals;
             final int newLen= proposals.length;
-            if cast(USE_VIRTUAL) {
+            if (USE_VIRTUAL) {
                 fProposalTable.setItemCount(newLen);
                 fProposalTable.clearAll();
             } else {
@@ -1193,7 +1193,7 @@
         if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) {
 
             ensureDocumentListenerInstalled();
-            
+
             if (fFocusHelper is null) {
                 fFocusHelper= new class()  IEditingSupport {
 
@@ -1367,18 +1367,18 @@
     private void selectProposal(int index, bool smartToggle) {
 
         ICompletionProposal oldProposal= getSelectedProposal();
-        if (oldProposal instanceof ICompletionProposalExtension2 && fViewer !is null)
+        if (cast(ICompletionProposalExtension2)oldProposal  && fViewer !is null)
             (cast(ICompletionProposalExtension2) oldProposal).unselected(fViewer);
 
         if (fFilteredProposals is null) {
             fireSelectionEvent(null, smartToggle);
             return;
         }
-        
+
         ICompletionProposal proposal= fFilteredProposals[index];
-        if (proposal instanceof ICompletionProposalExtension2 && fViewer !is null)
+        if (cast(ICompletionProposalExtension2)proposal && fViewer !is null)
             (cast(ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle);
-        
+
         fireSelectionEvent(proposal, smartToggle);
 
         fLastProposal= proposal;
@@ -1391,7 +1391,7 @@
 
     /**
      * Fires a selection event, see {@link ICompletionListener}.
-     * 
+     *
      * @param proposal the selected proposal, possibly <code>null</code>
      * @param smartToggle true if the smart toggle is on
      * @since 3.2
@@ -1483,13 +1483,13 @@
         List filtered= new ArrayList(length);
         for (int i= 0; i < length; i++) {
 
-            if (proposals[i] instanceof ICompletionProposalExtension2) {
+            if (cast(ICompletionProposalExtension2)proposals[i] ) {
 
                 ICompletionProposalExtension2 p= cast(ICompletionProposalExtension2) proposals[i];
                 if (p.validate(document, offset, event))
                     filtered.add(p);
 
-            } else if (proposals[i] instanceof ICompletionProposalExtension) {
+            } else if (cast(ICompletionProposalExtension)proposals[i] ) {
 
                 ICompletionProposalExtension p= cast(ICompletionProposalExtension) proposals[i];
                 if (p.isValidFor(document, offset))
@@ -1518,11 +1518,11 @@
             fProposalShell.setFocus();
         }
     }
-    
+
     /**
      * Returns <code>true</code> if <code>proposal</code> should be auto-inserted,
      * <code>false</code> otherwise.
-     * 
+     *
      * @param proposal the single proposal that might be automatically inserted
      * @return <code>true</code> if <code>proposal</code> can be inserted automatically,
      *         <code>false</code> otherwise
@@ -1574,7 +1574,7 @@
                     int count= (fFilteredProposals is null ? 0 : fFilteredProposals.length);
                     if (count is 0 && hideWhenNoProposals(false))
                         return;
-                    
+
                     if (count is 1 && canAutoInsert(fFilteredProposals[0])) {
                         insertProposal(fFilteredProposals[0], cast(wchar) 0, 0, fInvocationOffset);
                         hide();
@@ -1600,7 +1600,7 @@
      * proposal, it is inserted, otherwise, the common prefix of all proposals
      * is inserted into the document. If there is no common prefix, nothing
      * happens and <code>false</code> is returned.
-     * 
+     *
      * @return <code>true</code> if a single proposal was inserted and the
      *         selector can be closed, <code>false</code> otherwise
      * @since 3.0
@@ -1625,7 +1625,7 @@
         List rightCase= new ArrayList();
 
         bool isWrongCaseMatch= false;
-        
+
         // the prefix of all case insensitive matches. This differs from the document
         // contents and will be replaced.
         CharSequence wrongCasePrefix= null;
@@ -1636,10 +1636,10 @@
 
         for (int i= 0; i < fFilteredProposals.length; i++) {
             ICompletionProposal proposal= fFilteredProposals[i];
-            
+
             if (!( cast(ICompletionProposalExtension3)proposal ))
                 return false;
-            
+
             int start= (cast(ICompletionProposalExtension3)proposal).getPrefixCompletionStart(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset);
             CharSequence insertion= (cast(ICompletionProposalExtension3)proposal).getPrefixCompletionText(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset);
             if (insertion is null)
@@ -1769,19 +1769,19 @@
         int min= Math.min(buffer.length(), sequence.length());
         for (int c= 0; c < min; c++) {
             if (sequence.charAt(c) !is buffer.charAt(c)) {
-                buffer.delete(c, buffer.length());
+                buffer.delete_(c, buffer.length());
                 return;
             }
         }
 
         // all equal up to minimum
-        buffer.delete(min, buffer.length());
+        buffer.delete_(min, buffer.length());
     }
-    
+
     /**
      * Sets the message for the repetition affordance text at the bottom of the proposal. Only has
      * an effect if {@link ContentAssistant#isRepeatedInvocationMode()} returns <code>true</code>.
-     * 
+     *
      * @param message the new caption
      * @since 3.2
      */
@@ -1794,7 +1794,7 @@
     /**
      * Sets the text to be displayed if no proposals are available. Only has an effect if
      * {@link ContentAssistant#isShowEmptyList()} returns <code>true</code>.
-     * 
+     *
      * @param message the empty message
      * @since 3.2
      */
@@ -1805,14 +1805,14 @@
 
     /**
      * Enables or disables showing of the caption line. See also {@link #setMessage(String)}.
-     * 
+     *
      * @param show
      * @since 3.2
      */
     public void setStatusLineVisible(bool show) {
         if (!isActive() || show is (fMessageText !is null))
             return; // nothing to do
-        
+
         if (show) {
             createMessageText();
         } else {
@@ -1824,23 +1824,23 @@
 
     /**
      * Informs the popup that it is being placed above the caret line instead of below.
-     * 
+     *
      * @param above <code>true</code> if the location of the popup is above the caret line, <code>false</code> if it is below
      * @since 3.3
      */
     void switchedPositionToAbove(bool above) {
         if (fAdditionalInfoController !is null) {
-            fAdditionalInfoController.setFallbackAnchors(new Anchor[] {
+            fAdditionalInfoController.setFallbackAnchors([
                     AbstractInformationControlManager.ANCHOR_RIGHT,
                     AbstractInformationControlManager.ANCHOR_LEFT,
                     above ? AbstractInformationControlManager.ANCHOR_TOP : AbstractInformationControlManager.ANCHOR_BOTTOM
-            });
+            ]);
         }
     }
 
     /**
      * Returns a new proposal selection handler.
-     * 
+     *
      * @param operationCode the operation code
      * @return the handler
      * @since 3.4