Mercurial > projects > dwt-addons
comparison dwtx/jface/internal/text/link/contentassist/CompletionProposalPopup2.d @ 150:5cf141e43417
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 23:05:26 +0200 |
parents | 53b889547456 |
children | f70d9508c95c |
comparison
equal
deleted
inserted
replaced
149:b411f1c62131 | 150:5cf141e43417 |
---|---|
118 /** The most recently selected proposal. */ | 118 /** The most recently selected proposal. */ |
119 private ICompletionProposal fLastProposal; | 119 private ICompletionProposal fLastProposal; |
120 /** | 120 /** |
121 * Tells whether colored labels support is enabled. | 121 * Tells whether colored labels support is enabled. |
122 * Only valid while the popup is active. | 122 * Only valid while the popup is active. |
123 * | 123 * |
124 * @since 3.4 | 124 * @since 3.4 |
125 */ | 125 */ |
126 private bool fIsColoredLabelsSupportEnabled= false; | 126 private bool fIsColoredLabelsSupportEnabled= false; |
127 | 127 |
128 private final IEditingSupport fFocusEditingSupport= new class() IEditingSupport { | 128 private final IEditingSupport fFocusEditingSupport= new class() IEditingSupport { |
129 | 129 |
130 public bool isOriginator(DocumentEvent event, IRegion focus) { | 130 public bool isOriginator(DocumentEvent event, IRegion focus) { |
131 return false; | 131 return false; |
132 } | 132 } |
276 Control control= fViewer.getTextWidget(); | 276 Control control= fViewer.getTextWidget(); |
277 fProposalShell= new Shell(control.getShell(), DWT.ON_TOP); | 277 fProposalShell= new Shell(control.getShell(), DWT.ON_TOP); |
278 // fProposalShell= new Shell(control.getShell(), DWT.ON_TOP | DWT.RESIZE ); | 278 // fProposalShell= new Shell(control.getShell(), DWT.ON_TOP | DWT.RESIZE ); |
279 fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL); | 279 fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL); |
280 // fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL); | 280 // fProposalTable= new Table(fProposalShell, DWT.H_SCROLL | DWT.V_SCROLL); |
281 | 281 |
282 | 282 |
283 fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled(); | 283 fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled(); |
284 if (fIsColoredLabelsSupportEnabled) | 284 if (fIsColoredLabelsSupportEnabled) |
285 TableOwnerDrawSupport.install(fProposalTable); | 285 TableOwnerDrawSupport.install(fProposalTable); |
286 | 286 |
554 for (int i= 0; i < proposals.length; i++) { | 554 for (int i= 0; i < proposals.length; i++) { |
555 p= proposals[i]; | 555 p= proposals[i]; |
556 item= new TableItem(fProposalTable, DWT.NULL); | 556 item= new TableItem(fProposalTable, DWT.NULL); |
557 if (p.getImage() !is null) | 557 if (p.getImage() !is null) |
558 item.setImage(p.getImage()); | 558 item.setImage(p.getImage()); |
559 | 559 |
560 String displayString; | 560 String displayString; |
561 StyleRange[] styleRanges= null; | 561 StyleRange[] styleRanges= null; |
562 if (fIsColoredLabelsSupportEnabled && cast(ICompletionProposalExtension6)p ) { | 562 if (fIsColoredLabelsSupportEnabled && cast(ICompletionProposalExtension6)p ) { |
563 StyledString styledString= (cast(ICompletionProposalExtension6)p).getStyledDisplayString(); | 563 StyledString styledString= (cast(ICompletionProposalExtension6)p).getStyledDisplayString(); |
564 displayString= styledString.getString(); | 564 displayString= styledString.getString(); |
567 displayString= p.getDisplayString(); | 567 displayString= p.getDisplayString(); |
568 | 568 |
569 item.setText(displayString); | 569 item.setText(displayString); |
570 if (fIsColoredLabelsSupportEnabled) | 570 if (fIsColoredLabelsSupportEnabled) |
571 TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges); | 571 TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges); |
572 | 572 |
573 item.setData(p); | 573 item.setData(p); |
574 | 574 |
575 if (validate && validateProposal(document, p, endOffset, null)) { | 575 if (validate && validateProposal(document, p, endOffset, null)) { |
576 selectionIndex= i; | 576 selectionIndex= i; |
577 validate= false; | 577 validate= false; |
922 IDocument document= fViewer.getDocument(); | 922 IDocument document= fViewer.getDocument(); |
923 int length= proposals.length; | 923 int length= proposals.length; |
924 List filtered= new ArrayList(length); | 924 List filtered= new ArrayList(length); |
925 for (int i= 0; i < length; i++) { | 925 for (int i= 0; i < length; i++) { |
926 | 926 |
927 if (proposals[i] instanceof ICompletionProposalExtension2) { | 927 if (cast(ICompletionProposalExtension2)proposals[i] ) { |
928 | 928 |
929 ICompletionProposalExtension2 p= cast(ICompletionProposalExtension2) proposals[i]; | 929 ICompletionProposalExtension2 p= cast(ICompletionProposalExtension2) proposals[i]; |
930 if (p.validate(document, offset, event)) | 930 if (p.validate(document, offset, event)) |
931 filtered.add(p); | 931 filtered.add(p); |
932 | 932 |
933 } else if (proposals[i] instanceof ICompletionProposalExtension) { | 933 } else if (cast(ICompletionProposalExtension)proposals[i] ) { |
934 | 934 |
935 ICompletionProposalExtension p= cast(ICompletionProposalExtension) proposals[i]; | 935 ICompletionProposalExtension p= cast(ICompletionProposalExtension) proposals[i]; |
936 if (p.isValidFor(document, offset)) | 936 if (p.isValidFor(document, offset)) |
937 filtered.add(p); | 937 filtered.add(p); |
938 | 938 |