Mercurial > projects > dwt-addons
diff dwtx/jface/text/contentassist/CompletionProposalPopup.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | 7d818bd32d63 |
children | 65801ad2b265 |
line wrap: on
line diff
--- a/dwtx/jface/text/contentassist/CompletionProposalPopup.d Sun Aug 24 01:29:22 2008 +0200 +++ b/dwtx/jface/text/contentassist/CompletionProposalPopup.d Sun Aug 24 01:46:20 2008 +0200 @@ -523,7 +523,7 @@ return; if (count is 1 && !autoActivated && canAutoInsert(fComputedProposals[0])) { - insertProposal(fComputedProposals[0], (char) 0, 0, fInvocationOffset); + insertProposal(fComputedProposals[0], cast(wchar) 0, 0, fInvocationOffset); hide(); } else { createProposalSelector(); @@ -606,7 +606,7 @@ Control control= fContentAssistSubjectControlAdapter.getControl(); fProposalShell= new Shell(control.getShell(), DWT.ON_TOP | DWT.RESIZE ); fProposalShell.setFont(JFaceResources.getDefaultFont()); - if (USE_VIRTUAL) { + if cast(USE_VIRTUAL) { fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL | DWT.VIRTUAL); Listener listener= new Listener() { @@ -647,7 +647,7 @@ int height= fProposalTable.getItemHeight() * 10; // use golden ratio as default aspect ratio final double aspectRatio= (1 + Math.sqrt(5)) / 2; - int width= (int) (height * aspectRatio); + int width= cast(int) (height * aspectRatio); Rectangle trim= fProposalTable.computeTrim(0, 0, width, height); data.heightHint= trim.height; data.widthHint= trim.width; @@ -846,7 +846,7 @@ * @since 3.1 */ private void handleSetData(Event event) { - TableItem item= (TableItem) event.item; + TableItem item= cast(TableItem) event.item; int index= fProposalTable.indexOf(item); if (0 <= index && index < fFilteredProposals.length) { @@ -855,7 +855,7 @@ String displayString; StyleRange[] styleRanges= null; if (fIsColoredLabelsSupportEnabled && current instanceof ICompletionProposalExtension6) { - StyledString styledString= ((ICompletionProposalExtension6)current).getStyledDisplayString(); + StyledString styledString= (cast(ICompletionProposalExtension6)current).getStyledDisplayString(); displayString= styledString.getString(); styleRanges= styledString.getStyleRanges(); } else @@ -905,7 +905,7 @@ ICompletionProposal p= getSelectedProposal(); hide(); if (p !is null) - insertProposal(p, (char) 0, stateMask, fContentAssistSubjectControlAdapter.getSelectedRange().x); + insertProposal(p, cast(wchar) 0, stateMask, fContentAssistSubjectControlAdapter.getSelectedRange().x); } /** @@ -939,7 +939,7 @@ IDocument document= fContentAssistSubjectControlAdapter.getDocument(); if (fViewer instanceof ITextViewerExtension) { - ITextViewerExtension extension= (ITextViewerExtension) fViewer; + ITextViewerExtension extension= cast(ITextViewerExtension) fViewer; target= extension.getRewriteTarget(); } @@ -947,16 +947,16 @@ target.beginCompoundChange(); if (fViewer instanceof IEditingSupportRegistry) { - IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer; + IEditingSupportRegistry registry= cast(IEditingSupportRegistry) fViewer; registry.register(helper); } if (p instanceof ICompletionProposalExtension2 && fViewer !is null) { - ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p; + ICompletionProposalExtension2 e= cast(ICompletionProposalExtension2) p; e.apply(fViewer, trigger, stateMask, offset); } else if (p instanceof ICompletionProposalExtension) { - ICompletionProposalExtension e= (ICompletionProposalExtension) p; + ICompletionProposalExtension e= cast(ICompletionProposalExtension) p; e.apply(document, trigger, offset); } else { p.apply(document); @@ -973,7 +973,7 @@ int contextInformationOffset; if (p instanceof ICompletionProposalExtension) { - ICompletionProposalExtension e= (ICompletionProposalExtension) p; + ICompletionProposalExtension e= cast(ICompletionProposalExtension) p; contextInformationOffset= e.getContextInformationPosition(); } else { if (selection is null) @@ -991,7 +991,7 @@ target.endCompoundChange(); if (fViewer instanceof IEditingSupportRegistry) { - IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer; + IEditingSupportRegistry registry= cast(IEditingSupportRegistry) fViewer; registry.unregister(helper); } fInserting= false; @@ -1037,7 +1037,7 @@ unregister(); if (fViewer instanceof IEditingSupportRegistry) { - IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer; + IEditingSupportRegistry registry= cast(IEditingSupportRegistry) fViewer; registry.unregister(fFocusHelper); } @@ -1088,7 +1088,7 @@ if (fLastProposal !is null) { if (fLastProposal instanceof ICompletionProposalExtension2 && fViewer !is null) { - ICompletionProposalExtension2 extension= (ICompletionProposalExtension2) fLastProposal; + ICompletionProposalExtension2 extension= cast(ICompletionProposalExtension2) fLastProposal; extension.unselected(fViewer); } fLastProposal= null; @@ -1124,7 +1124,7 @@ if (Helper.okToUse(fProposalTable)) { if (oldProposal instanceof ICompletionProposalExtension2 && fViewer !is null) - ((ICompletionProposalExtension2) oldProposal).unselected(fViewer); + (cast(ICompletionProposalExtension2) oldProposal).unselected(fViewer); if (proposals is null || proposals.length is 0) { fEmptyProposal.fOffset= fFilterOffset; @@ -1134,7 +1134,7 @@ fFilteredProposals= proposals; final int newLen= proposals.length; - if (USE_VIRTUAL) { + if cast(USE_VIRTUAL) { fProposalTable.setItemCount(newLen); fProposalTable.clearAll(); } else { @@ -1208,7 +1208,7 @@ }; } if (fViewer instanceof IEditingSupportRegistry) { - IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer; + IEditingSupportRegistry registry= cast(IEditingSupportRegistry) fViewer; registry.register(fFocusHelper); } @@ -1343,7 +1343,7 @@ default: ICompletionProposal p= getSelectedProposal(); if (p instanceof ICompletionProposalExtension) { - ICompletionProposalExtension t= (ICompletionProposalExtension) p; + ICompletionProposalExtension t= cast(ICompletionProposalExtension) p; char[] triggers= t.getTriggerCharacters(); if (contains(triggers, key)) { e.doit= false; @@ -1368,7 +1368,7 @@ ICompletionProposal oldProposal= getSelectedProposal(); if (oldProposal instanceof ICompletionProposalExtension2 && fViewer !is null) - ((ICompletionProposalExtension2) oldProposal).unselected(fViewer); + (cast(ICompletionProposalExtension2) oldProposal).unselected(fViewer); if (fFilteredProposals is null) { fireSelectionEvent(null, smartToggle); @@ -1377,7 +1377,7 @@ ICompletionProposal proposal= fFilteredProposals[index]; if (proposal instanceof ICompletionProposalExtension2 && fViewer !is null) - ((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle); + (cast(ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle); fireSelectionEvent(proposal, smartToggle); @@ -1485,13 +1485,13 @@ if (proposals[i] instanceof ICompletionProposalExtension2) { - ICompletionProposalExtension2 p= (ICompletionProposalExtension2) proposals[i]; + ICompletionProposalExtension2 p= cast(ICompletionProposalExtension2) proposals[i]; if (p.validate(document, offset, event)) filtered.add(p); } else if (proposals[i] instanceof ICompletionProposalExtension) { - ICompletionProposalExtension p= (ICompletionProposalExtension) proposals[i]; + ICompletionProposalExtension p= cast(ICompletionProposalExtension) proposals[i]; if (p.isValidFor(document, offset)) filtered.add(p); @@ -1531,7 +1531,7 @@ private bool canAutoInsert(ICompletionProposal proposal) { if (fContentAssistant.isAutoInserting()) { if (proposal instanceof ICompletionProposalExtension4) { - ICompletionProposalExtension4 ext= (ICompletionProposalExtension4) proposal; + ICompletionProposalExtension4 ext= cast(ICompletionProposalExtension4) proposal; return ext.isAutoInsertable(); } return true; // default behavior before ICompletionProposalExtension4 was introduced @@ -1576,7 +1576,7 @@ return; if (count is 1 && canAutoInsert(fFilteredProposals[0])) { - insertProposal(fFilteredProposals[0], (char) 0, 0, fInvocationOffset); + insertProposal(fFilteredProposals[0], cast(wchar) 0, 0, fInvocationOffset); hide(); } else { ensureDocumentListenerInstalled(); @@ -1610,7 +1610,7 @@ // 0: insert single proposals if (fFilteredProposals.length is 1) { if (canAutoInsert(fFilteredProposals[0])) { - insertProposal(fFilteredProposals[0], (char) 0, 0, fFilterOffset); + insertProposal(fFilteredProposals[0], cast(wchar) 0, 0, fFilterOffset); hide(); return true; } @@ -1640,8 +1640,8 @@ if (!(proposal instanceof ICompletionProposalExtension3)) return false; - int start= ((ICompletionProposalExtension3)proposal).getPrefixCompletionStart(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset); - CharSequence insertion= ((ICompletionProposalExtension3)proposal).getPrefixCompletionText(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset); + 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(); try { @@ -1685,17 +1685,17 @@ // 2: replace single proposals if (rightCase.size() is 1) { - ICompletionProposal proposal= (ICompletionProposal) rightCase.get(0); + ICompletionProposal proposal= cast(ICompletionProposal) rightCase.get(0); if (canAutoInsert(proposal) && rightCasePostfix.length() > 0) { - insertProposal(proposal, (char) 0, 0, fInvocationOffset); + insertProposal(proposal, cast(wchar) 0, 0, fInvocationOffset); hide(); return true; } return false; } else if (isWrongCaseMatch && wrongCase.size() is 1) { - ICompletionProposal proposal= (ICompletionProposal) wrongCase.get(0); + ICompletionProposal proposal= cast(ICompletionProposal) wrongCase.get(0); if (canAutoInsert(proposal)) { - insertProposal(proposal, (char) 0, 0, fInvocationOffset); + insertProposal(proposal, cast(wchar) 0, 0, fInvocationOffset); hide(); return true; }