Mercurial > projects > dwt-addons
diff dwtx/jface/text/contentassist/CompletionProposalPopup.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | 7926b636c282 |
children | c3583c6ec027 |
line wrap: on
line diff
--- a/dwtx/jface/text/contentassist/CompletionProposalPopup.d Wed Aug 27 14:49:30 2008 +0200 +++ b/dwtx/jface/text/contentassist/CompletionProposalPopup.d Mon Sep 08 00:51:37 2008 +0200 @@ -312,7 +312,7 @@ int accelerator= SWTKeySupport.convertEventToUnmodifiedAccelerator(e); KeySequence sequence= KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator)); - if (sequence.equals(fCommandSequence)) + if (sequence==/++/fCommandSequence) if (fContentAssistant.isPrefixCompletionEnabled()) incrementalComplete(); else @@ -658,14 +658,14 @@ GridData data= new GridData(GridData.FILL_BOTH); - Point size= fContentAssistant.restoreCompletionProposalPopupSize(); + Point size= fContentAssistant.restoreCompletionProposalPopupSize_package(); if (size !is null) { fProposalTable.setLayoutData(data); fProposalShell.setSize(size); } else { int height= fProposalTable.getItemHeight() * 10; // use golden ratio as default aspect ratio - final double aspectRatio= (1 + Math.sqrt(5)) / 2; + double aspectRatio= (1 + Math.sqrt(5.0f)) / 2; int width= cast(int) (height * aspectRatio); Rectangle trim= fProposalTable.computeTrim(0, 0, width, height); data.heightHint= trim.height; @@ -842,7 +842,7 @@ fMessageText= new Label(fProposalShell, DWT.RIGHT); GridData textData= new GridData(DWT.FILL, DWT.BOTTOM, true, false); fMessageText.setLayoutData(textData); - fMessageText.setText(fContentAssistant.getStatusMessage() + " "); //$NON-NLS-1$ + fMessageText.setText(fContentAssistant.getStatusMessage() ~ " "); //$NON-NLS-1$ if (fMessageTextFont is null) { Font font= fMessageText.getFont(); Display display= fProposalShell.getDisplay(); @@ -895,7 +895,7 @@ TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges); item.setImage(current.getImage()); - item.setData(current); + item.setData(cast(Object)current); } else { // this should not happen, but does on win32 } @@ -1129,7 +1129,7 @@ fFilteredProposals= null; fComputedProposals= null; - fContentAssistant.possibleCompletionsClosed(); + fContentAssistant.possibleCompletionsClosed_package(); } /** @@ -1178,7 +1178,7 @@ ICompletionProposal proposal= proposals[i]; item.setText(proposal.getDisplayString()); item.setImage(proposal.getImage()); - item.setData(proposal); + item.setData(cast(Object)proposal); } fProposalTable.setRedraw(true); } @@ -1199,7 +1199,7 @@ */ private Point getLocation() { int caret= fContentAssistSubjectControlAdapter.getCaretOffset(); - Rectangle location= fContentAssistant.getLayoutManager().computeBoundsBelowAbove(fProposalShell, fSize is null ? fProposalShell.getSize() : fSize, caret, this); + Rectangle location= fContentAssistant.getLayoutManager().computeBoundsBelowAbove_package(fProposalShell, fSize is null ? fProposalShell.getSize() : fSize, caret, this); return Geometry.getLocation(location); } @@ -1519,13 +1519,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 @@ -1653,7 +1653,7 @@ IDocument document= fContentAssistSubjectControlAdapter.getDocument(); // contains the common postfix in the case that there are any proposals matching our LHS - StringBuffer rightCasePostfix= null; + StringBuffer rightCasePostfix; List rightCase= new ArrayList(); bool isWrongCaseMatch= false; @@ -1663,7 +1663,7 @@ CharSequence wrongCasePrefix= null; int wrongCasePrefixStart= 0; // contains the common postfix of all case-insensitive matches - StringBuffer wrongCasePostfix= null; + StringBuffer wrongCasePostfix; List wrongCase= new ArrayList(); for (int i= 0; i < fFilteredProposals.length; i++) { @@ -1675,14 +1675,14 @@ int start= (cast(ICompletionProposalExtension3)proposal).getPrefixCompletionStart(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset); CharSequence insertion= (cast(ICompletionProposalExtension3)proposal).getPrefixCompletionText(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset); if (insertion is null) - insertion= proposal.getDisplayString(); + insertion= new StringCharSequence(proposal.getDisplayString()); try { int prefixLength= fFilterOffset - start; int relativeCompletionOffset= Math.min(insertion.length(), prefixLength); String prefix= document.get(start, prefixLength); if (!isWrongCaseMatch && insertion.toString().startsWith(prefix)) { isWrongCaseMatch= false; - rightCase.add(proposal); + rightCase.add(cast(Object)proposal); CharSequence newPostfix= insertion.subSequence(relativeCompletionOffset, insertion.length()); if (rightCasePostfix is null) rightCasePostfix= new StringBuffer(newPostfix.toString()); @@ -1699,7 +1699,7 @@ wrongCasePostfix= new StringBuffer(newPostfix.toString()); else truncatePostfix(wrongCasePostfix, newPostfix); - wrongCase.add(proposal); + wrongCase.add(cast(Object)proposal); } else { return false; } @@ -1740,13 +1740,13 @@ if (isWrongCaseMatch) prefix= wrongCasePrefix; else - prefix= ""; //$NON-NLS-1$ + prefix= new StringCharSequence(""); //$NON-NLS-1$ CharSequence postfix; if (isWrongCaseMatch) - postfix= wrongCasePostfix; + postfix= new StringCharSequence(wrongCasePostfix.toString); else - postfix= rightCasePostfix; + postfix= new StringCharSequence(rightCasePostfix.toString); if (prefix is null || postfix is null) return false; @@ -1758,7 +1758,7 @@ truncatePostfix(inDocument, postfix); // 5: replace and reveal - document.replace(fFilterOffset - prefix.length(), prefix.length() + inDocument.length(), prefix.toString() + postfix.toString()); + document.replace(fFilterOffset - prefix.length(), prefix.length() + inDocument.length(), prefix.toString() ~ postfix.toString()); fContentAssistSubjectControlAdapter.setSelectedRange(fFilterOffset + postfix.length(), 0); fContentAssistSubjectControlAdapter.revealRange(fFilterOffset + postfix.length(), 0); @@ -1783,8 +1783,8 @@ int oneEnd= oneOffset + oneSequence.length(); int twoEnd= twoOffset + twoSequence.length(); - String one= document.get(oneOffset, min - oneOffset) + oneSequence + document.get(oneEnd, Math.min(fFilterOffset, fFilterOffset - oneEnd)); - String two= document.get(twoOffset, min - twoOffset) + twoSequence + document.get(twoEnd, Math.min(fFilterOffset, fFilterOffset - twoEnd)); + String one= document.get(oneOffset, min - oneOffset) ~ oneSequence.toString ~ document.get(oneEnd, Math.min(fFilterOffset, fFilterOffset - oneEnd)); + String two= document.get(twoOffset, min - twoOffset) ~ twoSequence.toString ~ document.get(twoEnd, Math.min(fFilterOffset, fFilterOffset - twoEnd)); return one.equals(two); } @@ -1800,14 +1800,14 @@ // find common prefix 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()); + if (sequence.charAt(c) !is buffer.slice()[c]) { + buffer.truncate(c); return; } } // all equal up to minimum - buffer.delete_(min, buffer.length()); + buffer.truncate(min); } /** @@ -1820,7 +1820,7 @@ void setMessage(String message) { Assert.isNotNull(message); if (isActive() && fMessageText !is null) - fMessageText.setText(message + " "); //$NON-NLS-1$ + fMessageText.setText(message ~ " "); //$NON-NLS-1$ } /**